Starting built in Apache server in Mac OS X 10.9 (Mavericks)

6

4

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

Bagusflyer

Posted 2013-11-17T03:54:33.197

Reputation: 181

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 – 2013-11-17T04:14:06.483

Answers

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.

sitiveni

Posted 2013-11-17T03:54:33.197

Reputation: 216

This solution seems to work well. – swt83 – 2014-09-12T16:23:47.917

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 – 2013-11-18T04:19:10.350