Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 439
Zach Shallbetter Avatar asked Aug 11 '14 19:08

Zach Shallbetter


People also ask

What causes 403 Access Denied?

The 403 Forbidden error appears when your server denies you permission to access a page on your site. This is mainly caused by a faulty security plugin, a corrupt . htaccess file, or incorrect file permissions on your server.


2 Answers

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 mod_userdir.so 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 </Directory> 

Apache 2.4

<Directory "/Users/jnovack/Sites/">   Options Indexes MultiViews   AllowOverride All   # OSX 10.10 / Apache 2.4   Require all granted </Directory> 
like image 191
jnovack Avatar answered Sep 24 '22 20:09

jnovack


Edit the file: /private/etc/apache2/httpd.conf

on line 250 (in Yosemite) change:

Options FollowSymLinks Multiviews 

to:

Options FollowSymLinks Multiviews Indexes 

then in the Terminal run:

sudo apachectl restart 
like image 40
tomvon Avatar answered Sep 21 '22 20:09

tomvon