Macos – 403 Forbidden Error on Mac OS X Localhost

apache-http-servermacososx-snow-leopard

I set up Web Sharing in System Preferences on Mac OS X 10.6 and clicked the link it gave me there. Unfortuantely, Apache gave me this 403 error:

Forbidden

You don't have permission to access
/~myusername/index.html on this
server.

Access log displays: 10.0.1.2 - - [30/Jun/2010:16:25:15 -0700] "GET /~myusername/ HTTP/1.1" 403 210

Error log displays: [Wed Jun 30 16:26:09 2010] [error] [client 10.0.1.2] client denied by server configuration: /Users/myusername/Sites/

Curiously enough, accessing http://localhost works fine. It's just with two of the user folders that I've having trouble with, the other user folder, which is newer than my system upgrade, is working fine.

I've had this working on my machine in Leopard before, so I chmodded everything in ~/Sites to 755, which didn't do any good. Any suggestions? I presume I've done something to my machine that's caused this, since I can't imagine Apple messing up on something like this.

I did set up PEAR with these instructions, but I have no idea if that could be the cause of it.

Best Answer

Apple has a support document for this problem. Fixing the issue involves creating a file /etc/apache2/users/yourusername.conf (yourusername being the account short name, e.g. danielbeck – it's usually the name of your home folder in /Users) with the following contents:

<Directory "/Users/yourusername/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Afterwards, run sudo chown root:wheel /etc/apache2/users/yourusername.conf and restart Apache.

Related Question