4

I have been following this tutorial in order to setup my local ~/Sites folder.

/etc/apache2/users/carloabelli.conf:

<Directory "/Users/carloabelli/Sites/">
    Options FollowSymLinks Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

I have restarted apache numerous times. Whenever I go the the url http://localhost/~carloabelli I get the following response:

403 Forbidden

You don't have permission to access /~carloabelli on this server.

What else do I need to do to get this to work?

1

Take a look at the Permissions set on the /Users/<username>/Sites Folder.

The "web user" (i think on Mac www is used for this) must have the Rights to read and execute so in most cases a chmod o+rx /Users/<username>/Sites should be enough.

If this doesn't work let us know what you are using to control your Webserver? OSX Server or MAMP or something else?

1

In your httpd.conf file you will see User and Group at the top You have to sent

User <your uer name>
Group www (no change needed)

You have to change it because the default apache user _www which will not have access to the directories under <user>, _www will have access only to /Library/WebServer/Documents/ So you have to change the user in httpd.conf. So that apache can access the files under your user Documents. Hope it helps

  • 1
    Thank you @DavidRicherby, Yes you are right.. let me update my answer and follow this hearafter. – Dilip Rajkumar Jun 27 '15 at 20:19
  • Thank you, I replaced the User with my username and it worked – Ahmad Alfy Jul 29 '18 at 9:41
1

Aside from getting the permissions correct for reading and executing the Sites directory and its parents, recent configs, i.e, 10.12, require additional configuration options in several files:

/etc/apache2/httpd.conf. -- uncomment:

    LoadModule userdir_module libexec/apache2/mod_userdir.so
    ...
    Include /private/etc/apache2/extra/httpd-userdir.conf

/etc/apache2/extra/httpd-userdir.conf -- Uncomment:

    Include /private/etc/apache2/users/*.conf

Create a file /etc/apache2/users/YOUR_USERNAME_HERE.conf with:

<Directory "/Users/YOUR_USERNAME_HERE/Sites/">
    Options Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

If the lines are commented out, your per-user file will not be read.

Reference: https://superuser.com/questions/225346/how-do-i-setup-a-localhost-using-the-sites-folder-on-my-mac/566617#comment1813417_566617 and preceeding.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .