MacOS – How to fix permission denied for home folder with Apache in Mavericks

apachemacospermissionwebserver

I recently activated the apache that ships with OS X Mavericks.
I followed some tutorial to set up the web-server, however. When I browse to my home-filter at http://localhost/~nazeem, I get the following error: You don't have permission to access /~nazeem/ on this server.

Installation steps

To setp up the webserver, I took the following steps:

  1. activated the webserver with command: apachectl start
  2. enabled PHP by checking if the module is loaded
  3. checked if the home folder module is loaded
  4. made the user based configuration file, in /etc/apache2/users/nazeem.conf
    The content is as follows:

    <Directory "/Users/nazeem/Development/Websites/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    </Directory>

Permissions

~/nazeem : drwxr-xr-x+
~/nazeem/Development : drwxr-xr-x
~/nazeem/Development/Websites : drwxr-xr-x

Log

The apache log says the following:

[Mon May 19 21:22:57 2014] [error] [client ::1] client denied by server configuration: /Users/nazeem/Sites

In My opinion this is remarkable, as the path /Users/nazeem/Sites is nog what I defined in my user configuration.

Versions

OS X Mavericks 10.9.3
Apache 2.2.26

Does anybody know how to solve this?

Best Answer

In your computer's main apache config file, there is a designated "DocumentRoot", which appears to be set to ~/Sites - hence /Users/nazeem/Sites.

Try setting a document root in your /etc/apache2/users/nazeem.conf file, something like this:

DocumentRoot "/Users/nazeem/Development/Websites"

That's NOT within the Directory section of your nazeem.theconf file.

Note that the main apache config probably also designates the directory aliased as "cgi-bin". It's probably /Library/Webserver/CGI-Executables. Either use that directory for your executables, or post a follow-up about ScriptAlias settings.

And of course after any change to your apache config:

sudo apachectl restart

HTH