403 Forbidden: Web Sharing Stopped Working After OS X 10.8 Upgrade

Like a kid on Christmas, I was very excited to get up this morning. Not for presents mind you, but for the release of the OS X 10.8 Mountain Lion upgrade.

I wasted no time buying, downloading and installing the upgrade. Everything seemed to go well and within 45 minutes the download and upgrade had completed. Everything seemed to work except for my local webserver which was returning a 403 Forbidden error when attempting to view any webpage under my http://localhost/~john/ web directory.

After some investigation and reading through countless ‘setup apache on Mac OS X’ articles, I found out that the john.conf file was missing from the /etc/apache2/users directory. For anyone who is having the same issue, follow the instructions below to restore it:

1) Open Terminal.app (Can be found in the Utilities folder of your Applications folder)
2) Navigate to the /etc/apache2/users directory.

Use: cd /etc/apache2/users

3) From here, I had a Guest.conf file, but no john.conf file, so I just copied the Guest.conf file and named it john.conf (note: you’ll need your admin password to copy the file)

Use: sudo cp Guest.conf username.conf

You’ll need to change the ‘username‘ part of username.conf to be the same as your username on your mac. This is also the same name as your user folder in the /Users folder at the root of your harddrive

4) Open the new .conf file you made.

Use: sudo nano username.conf (again, replace username.conf with the name of your file)

5) Change ‘Guest’ in the <Directory “…”> tag to your username
6) Press CTRL+x to Exit, and then Y to save changes.
7) Restart the apache server using the following command

Use: sudo apachectl restart

At this point, you should be able to browse your web pages that exist in your /Sites folder of your user directory.

Other webserver extensions may have been removed or disabled by the upgrade. One thing that I had to re-enable was PHP, which I was able to do by following Step 2 on this site.

Leave a Reply

%d bloggers like this: