403 Forbidden Error on Mac OS X Localhost
Solution 1:
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.
Solution 2:
For Apache to see the file, the user that Apache runs as (probably www
or _www
) must have access to these users' Sites directories. Having read/execute access to the contents of ~/Sites
is not enough, because it has to be allowed to traverse from /
down the path to ~/Sites
. So make sure /
, /Users
, /Users/myusername
, and /Users/myusername/Sites
all have at least a+x
permission (the eXecute bit on directories allows that user class to traverse the directory, even if Read access is not allowed).
ls -lde / /Users/ /Users/myusername/ /Users/myusername/Sites
If any of those directories doesn't show the last x
set (the one for "others"), then use something like chmod a+x ...
to set it for that directory.
If the ACL for any of those directories shows that user www
has been specifically denied access, then use the appropriate arguments to chmod
to fix the ACLs.
Solution 3:
For reference, I just dealt with this, and none of the answers here worked in my specific case. I was configuring virtual hosts, but more importantly, I needed my htaccess files to actually work.
I changed on "AllowOverride None" to "AllowOverride All" in my /etc/apache2/users/USERNAME.conf file, and all of my sites started to be forbidden.
I changed it back and and then changed it only for one site in my httpd-vhosts.conf file, and only that site was forbidden.
After looking at the logs and seeing the problem was with url rewriting and the lack of FollowSymLinks, I went back to the USERNAME.conf file. I switch "AllowOverride None" to "AllowOverride All" and added "Options +FollowSymLinks" on the next line.
Things started working. I came from using xampp on windows and it had a lot of these settings already set server-wide for dummies like me.