403 Forbidden error when accessing localhost on Mac OS X10.8

岁酱吖の 提交于 2019-12-04 09:34:35

问题


I have followed this tutorial to set up Apache, MySql and PHP on Mac OS X 10.8 (http://coolestguyplanettech.com/downtown/install-and-configure-apache-mysql-php-and-phpmyadmin-osx-108-mountain-lion)

When I go to 'Localhost' I get the following error:

Forbidden

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

When I go to 'Localhost/~benthompson' it works fine.

When I was halfway through the tutorial, 'Localhost' did work, its something later on that stopped it working.

Presumably its a permissions issue, but where?


回答1:


To fix that issue check this link http://www.coolestguidesontheplanet.com/downtown/how-set-virtual-hosts-apache-mac-osx-109-mavericks-and-osx-108-mountain-lion read the "Losing Localhost" part.

The error occurs just after you enable vhosts in the httpd.conf file. By uncommenting this line:

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

Adding this in the httpd-vhosts.conf will fix your issue. Just remember to add new vhosts before this one :D

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

I hope this solves your problem!



来源:https://stackoverflow.com/questions/18750184/403-forbidden-error-when-accessing-localhost-on-mac-os-x10-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!