6

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

1
  • Is it related to my Server application recently installed? I got the same problem when I start the website service in my Server application.
    – Bagusflyer
    Nov 17 '13 at 4:14
10

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.

2
  • 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.
    – Bagusflyer
    Nov 18 '13 at 4:19
  • This solution seems to work well.
    – swt83
    Sep 12 '14 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.