Server Fault is a question and answer site for system and network administrators. 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

In a fresh linux instalation, apache's document root points to /var/www/html

user apache
group apache
DocumentRoot /var/www/html
<Directory /var/www/html>
# ...

I want my documentRoot points to "/home/myapp/release/1.0.0/src/public", so I've made this changes:

DocumentRoot /home/myapp/release/1.0.0/src/public
<Directory /home/myapp/release/1.0.0/src/public>
# ...

But now I'm getting the 'Forbidden' error message. So what is the correct way to configure permissions in order to resolve this issue in a production enviroment.

share|improve this question

migrated from Mar 3 '11 at 4:33

This question came from our site for professional and enthusiast programmers.

Does the apache user have read access to the target folder? /home/myapp/release/1.0.0/src/public – kg_ Mar 2 '11 at 23:32
Does the apache user have read access to the target folder? If not, that is probably why Apache is giving you the Forbidden error message. – kg_ Mar 2 '11 at 23:57
up vote 2 down vote accepted

I can think of two possible problems:

  1. Actual directory permissions are screwed up. This is fairly easy to test by changing to the user that Apache runs as and attempting to list that directory (assuming Apache is configured to run as "www-data"):

    sudo su -s /bin/sh www-data
    ls /home/myapp/release/1.0.0/src/public/

    If the Apache user does not have access, every directory in the path, starting from / will need to have read and execute permissions either for the Apache user or for "other":

    sudo chmod o+rx /home /home/myapp /home/myapp/release  /home/myapp/release/1.0.0 \
        /home/myapp/release/1.0.0/src /home/myapp/release/1.0.0/src/public
  2. You're trying to access a directory via Apache that does not contain an index file and you have not enabled "Indexes". This is also easy to test by looking to see if there is a file named index.html (or .php, .htm, etc.) in /home/myapp/release/1.0.0/src/public. If there is not, either add one or add Options +Indexes to the <Directory /home/myapp/release/1.0.0/src/public> block.

share|improve this answer

The apache user must have read permission in that directory. Also include these directives:

<Directory /home/myapp/release/1.0.0/src/public>
   # ...
   Order Allow,Deny
   Allow from all
share|improve this answer
These directives are already in the httpd.conf file How can I give correctly the required permissions?. I don't want to do a chmod 777 -Rf – texai Mar 3 '11 at 2:40

Your Answer


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.