Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

The default location of Document root as per httpd.conf is /Library/WebServer/Documents. I want this location to be /webcontent. So to do that, I created a webcontent folder in root(/). Then in the httpd.conf:

  • Changed the Document root line to DocumentRoot /webcontent
  • Changed the Directory tag to <Directory "/webcontent">;

After restarting the Apache I'm getting the following page:

Forbidden

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

Could anyone please tell me whether I need to change any permissions anywhere else to change the document root?

share|improve this question
    
Do you have an index.html stored in /webcontent/? –  earl Jul 18 '10 at 15:19
    
No, but I have a test.html placed inside the webcontent folder. When I access it I'm getting this forbidden error. Is it mandatory to add index.html? –  tintin Jul 18 '10 at 20:59

2 Answers 2

up vote 8 down vote accepted

The httpd.conf file provided with OS X has a default deny that locks down every directory from every client. It then allows access to the DocumentRoot directory — that would be the default of /Library/WebServer/Documents. Page down some in that file and you'll see:

<Directory "/Library/WebServer/Documents">
    # [...]
    Options Indexes FollowSymLinks MultiViews

    # [...]
    AllowOverride None

    # [...]
    Order allow,deny
    Allow from all

</Directory>

Change the "/Library/WebServer/Documents" bit to "/webcontent" and you're good.

share|improve this answer

To follow on from @Bred Ackerman answer if your using apache vhost you will need to add: private/etc/apache2/extra/httpd-vhosts.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "/Users/fred/Sites"
    ServerName 127.0.0.1
    ServerAlias localhost
    ErrorLog "/private/var/log/apache2/localhost-error_log"
    CustomLog "/private/var/log/apache2/localhost-access_log" common
</VirtualHost>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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