403在Mac OS X10.8上访问localhost时出现Forbidden错误

时间:2013-09-11 20:01:20

标签: apache permissions osx-mountain-lion

我已按照本教程在Mac OS X 10.8上设置Apache,MySql和PHP(http://coolestguyplanettech.com/downtown/install-and-configure-apache-mysql-php-and-phpmyadmin-osx-108-mountain-lion

当我去'Localhost'时,我收到以下错误:

Forbidden

You don't have permission to access / on this server.

当我去'Localhost / ~benthompson'时它工作正常。

当我在教程的中途,'Localhost'确实有效,稍后它就会停止工作。

可能是一个权限问题,但在哪里?

1 个答案:

答案 0 :(得分:33)

要解决此问题,请检查此链接http://www.coolestguidesontheplanet.com/downtown/how-set-virtual-hosts-apache-mac-osx-109-mavericks-and-osx-108-mountain-lion是否阅读“丢失本地主机”部分。

在httpd.conf文件中启用vhost后发生错误。 通过取消注释这一行:

Include /private/etc/apache2/extra/httpd-vhosts.conf

在httpd-vhosts.conf中添加它可以解决您的问题。请记住在此之前添加新的虚拟主机:D

<VirtualHost *:80> 
   ServerName localhost
   DocumentRoot /Library/WebServer/Documents/
</VirtualHost>

我希望这能解决你的问题!

相关问题