This apache error is the bane of my existence. It is sometimes nearly impossible to figure out even though I know the fundamentals of the httpd web server. On mountain lion, you should generally debug this like so:
- Make sure the user/group specified in httpd.conf is www/www
- Make sure the directory has execute permissions for www
- Make sure the directory has a default (index.php or index.html)
- Make sure that default is readable by www
- Make sure that ALL encapsulating directories are executable by www (readable)
It is this last point that I want the emphasize because I had this issue moving to Mountain Lion (OS X 10.8). Your user Documents directory is 700 and is owned by you. If you try to serve a file anywhere below this directory, you’ll have problems. So there are two things you can do to find out if the error is due to parent permissions:
- go to the web root and do `ls -leahG` on that directory, cd ../, rinse, repeat; taking note of all permissions.
- use the spectacular parsepath.pl tool. Throw this into /usr/local/bin and give it execute permissions and run it on your default index file.
From number 2 above, you’ll get something like this:
d 0755 root:wheel /
d 0755 root:admin /Users
d 0755 beetle:staff /Users/beetle
d 0700 beetle:staff /Users/beetle/Documents
d 0755 beetle:staff /Users/beetle/Documents/Projects
d 0755 beetle:staff /Users/beetle/Documents/Projects/aaa
d 0755 beetle:staff /Users/beetle/Documents/Projects/aaa/bbb
d 0755 beetle:staff /Users/beetle/Documents/Projects/aaa/bbb/web
f 0644 beetle:staff /Users/beetle/Documents/Projects/aaa/bbb/web/index.php
Boom. /Users/beetle/Documents has 700 permissions and www is denied. chmod this to 755 and everything should be good. You could also modify the parsepath.pl file to give you `ls -leahG` info as well.
Another thing I learned during this process is /etc/paths is a fine location to store your path info. Update this file and source /etc/bashrc will get you on your way. Neato.