Zach Shallbetter Zach Shallbetter - 1 year ago 143
Apache Configuration Question

Apache localhost 403 error with Yosemite

I've just installed Mac OS X Yosemite fresh. I configured Apache and chmodded "users/user/Sites" to 755. When I hit localhost I receive a 403

Forbidden "You don't have permission to access / on this server"
. The same thing occurs with any other sites I add to my hosts file.

I tried configuring user directories following help from this post. The guys on this MacRumors thread know there is an Apache issue, but didn't offer a lot of suggestions.

My directory permissions look like this

drwxr-xr-x 29 root wheel 1054 Aug 11 07:30 /
drwxr-xr-x 6 root admin 204 Aug 11 07:29 /Users/
drwxr-xr-x+ 26 zachshallbetter staff 884 Aug 11 11:57 /Users/zachshallbetter/
0: group:everyone deny delete
drwxr-xr-x 5 zachshallbetter staff 170 Aug 11 10:16 /Users/zachshallbetter/Sites

Can anyone offer any suggestions or help? Here are links to my hosts and httpd.conf files and error logs for reference.

Answer Source

You do NOT want to open up the entirety of your hard drive to the web server process. In fact, lines 215-217 of httpd.conf say:

# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.

Apache 2.4 (OSX 10.10 Yosemite) has a different structure from Apache 2.2 (OSX 10.9) for the Directory directive in Module mod_authz_core.

EDIT: If you are setting up Apache from the START, please follow this instruction set to setup apache and php on OSX 10.10 Yosemite.

Assuming you have enabled already, your problem is within your user .conf file (/etc/apache2/users/username.conf), edit (or add) the following.

Apache 2.2:

<Directory "/Users/jnovack/Sites/">
  Options Indexes MultiViews
  AllowOverride All
  # OSX 10.9 / Apache 2.2
  Order from deny, allow

Apache 2.4

<Directory "/Users/jnovack/Sites/">
  Options Indexes MultiViews
  AllowOverride All
  # OSX 10.10 / Apache 2.4
  Require all granted
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download