How to fix 403 in Mac OS X built-in Apache

apacheopen sourcepermission

I'm trying to set a local environment on my new MacBook Air 13": built-in Apache with my own DocumentRoot, PHP, and MySQL. I usually update /etc/hosts just to run my local websites with a pretty permalink: local/example. For references, I usually check:

This time I'm simply getting a 403 Forbidden error every time I hit 127.0.0.1, localhost, or local. First I saw through the terminal that both Apache and PHP are running (even though I can't view PHP pages); then I updated all permissions according to Apache permissions; now I'm just desperate. Here are the relevant Apache configs:

  • /etc/hosts (view file — added one line)
  • /etc/apache2/httpd.conf (view file — updated the DocumentRoot)
  • /etc/apache2/users/joao.conf (view file — created this file)
  • /etc/apache2/extra/httpd-vhosts.conf (view file — updated VirtualHost)

It looks like Apache is somehow denying me access to my DocumentRoot (which by the way is ~/Sites). Because ~/Sites is actually a symlink, I then tried to update DocumentRoot with the following paths (all pointing to the same directory):

  • ~/Sites
  • /Users/joao/Sites
  • /Users/joao/Dropbox/Workflow/Sites (the original directory)

Still throwing 403. Any ideas how to fix/debug this?

Quick update — here's what my /var/log/apache2/joao.pt-error_log looks like:

[Sun Jul 07 12:50:45 2013] [error] [client 127.0.0.1] (13)Permission denied: access to / denied
[Sun Jul 07 12:50:45 2013] [error] [client 127.0.0.1] (13)Permission denied: access to /favicon.ico denied
[Sun Jul 07 12:50:45 2013] [error] [client 127.0.0.1] (13)Permission denied: access to /favicon.ico denied
[Sun Jul 07 12:50:45 2013] [error] [client 127.0.0.1] (13)Permission denied: access to /favicon.ico denied
[Sun Jul 07 12:50:47 2013] [error] [client ::1] (13)Permission denied: access to / denied
[Sun Jul 07 12:50:47 2013] [error] [client ::1] (13)Permission denied: access to / denied
[Sun Jul 07 12:50:48 2013] [error] [client ::1] (13)Permission denied: access to /favicon.ico denied
[Sun Jul 07 12:50:48 2013] [error] [client ::1] (13)Permission denied: access to /favicon.ico denied

Best Answer

I have an alias specified in OSX server pointing to a user directory. I spent a long while chmodding and messing with _www user, adding executable permissions recursively, uninstalling macports and all sorts of stuff trying to get this to work. No idea why it wasn't working.

Eventually, I just checked the "shared folder" checkbox in the Finder for that folder, and it worked, on the specified domain, with php active, the way I wanted it to. :/ ...so that was easy.