Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 774
Ben Thompson Avatar asked Sep 11 '13 20:09

Ben Thompson


People also ask

What is the 403 Forbidden error & how do you fix it?

A 403 Forbidden Error occurs when you do not have permission to access a web page or something else on a web server. It's usually a problem with the website itself. However, you can try refreshing the page, clearing your cache and cookies, and disconnecting from any VPN you might be using.

Why do I keep seeing 403 Forbidden?

The 403 Forbidden error appears when your server denies you permission to access a page on your site. This is mainly caused by a faulty security plugin, a corrupt . htaccess file, or incorrect file permissions on your server.


1 Answers

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!

like image 96
Nico Avatar answered Sep 28 '22 03:09

Nico