I'd like to start my apache server on my Mac running OS X (10.9) Mavericks. Here is what I did:
- Goto terminal
- sudo apachectl start
- The server started without problem. But I got the following problem when I tried to open the localhost in web browser:
You don't have permission to access / on this server.
Here is my httpd.conf file in my /etc/apache2: (I didn't change anything here)
DocumentRoot "/Library/WebServer/Documents"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all </Directory>
<Directory "/Library/WebServer/Documents">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Can anybody advise what could be the cause ? Thanks
Best Answer
I run into the same issue. After some goggling I figured that the main issue is that Apache runs as user _www whereas your files probably are under your own user. List the content of your webroot folder in Terminal (ls -l) to see the user and its group.
I found this link which provides a "better solution" instead of "changing the owner" or "changing the permissions": http://francoisdeschenes.com/2013/02/26/enable-write-permissions-for-apache-built-into-mac-os-x
In short, do this (replace <dir> with the name of your folder):
Of course, all the glory goes to Francois.