Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to start my apache server on my Mac running OS X (10.9) Mavericks. Here is what I did:

  1. Goto terminal
  2. sudo apachectl start
  3. 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

share|improve this question
    
Is it related to my Server application recently installed? I got the same problem when I start the website service in my Server application. – Zhou Hao Nov 17 '13 at 4:14
up vote 10 down vote accepted

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):

sudo chmod -R +a '_www allow read,write,delete,add_file,add_subdirectory,file_inherit,directory_inherit' <dir>

Of course, all the glory goes to Francois.

share|improve this answer
    
I don't know what I did. Then the website suddenly works. I guess it's because I uninstall the "Server" and reinstall it.Anyway, I think your answer should be correct. I'll definitely follow this instruction if I encounter this problem again. Thanks. – Zhou Hao Nov 18 '13 at 4:19
    
This solution seems to work well. – swt83 Sep 12 '14 at 16:23

You must log in to answer this question.

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