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.

My files are all owned by apache:apache. All directories have 770 permissions and files have 660 permissions. My original virtualhost seems to be fine but the second one is getting 403 errors on all paths.

Here's my current configuration in /etc/httpd/conf/httpd.conf

<Directory "/var/www/site1">
        Options Indexes FollowSymLinks
        AllowOverride All
        <IfModule mod_access.c>
                Order allow,deny
                Allow from all
        </IfModule>
</Directory>

<Directory "/var/www/site2">
        Options Indexes FollowSymLinks
        AllowOverride All
        <IfModule mod_access.c>
                Order allow,deny
                Allow from all
        </IfModule>
</Directory>

<VirtualHost *:80>
        ServerAdmin     serveradmin@domain.com
        DocumentRoot    /var/www/site1/
        ServerName      site1.domain.com
        ErrorLog        /var/log/httpd/site1.error.log
        CustomLog       /var/log/httpd/site1.access.log common
</VirtualHost>

<VirtualHost *:80>
        ServerAdmin     serveradmin@domain.com
        DocumentRoot    /var/www/site2/
        ServerName      site2.domain.com
        ErrorLog        /var/log/httpd/site2.error.log
        CustomLog       /var/log/httpd/site2.access.log common
</VirtualHost>
share|improve this question
2  
Is SELinux enabled and did you apply the correct context to the document root? Hint: restorecon -R /var/www –  fuero Oct 9 '13 at 5:37
    
That worked! Will you add that as an answer so I can accept it as such? Also, if you could explain any explanation to why it worked, that'd be awesome. Thank you. –  eisaacson Oct 9 '13 at 14:55

1 Answer 1

up vote 2 down vote accepted

SELinux is likely to be the culprit here.

Somehow the parent's context wasn't inherited correctly when creating files/directories in the /var/www directory.

Setting the container implicitly with restorecon or explicitely with chcon should fix the issue.

Watch out for lines in /var/log/audit.log when you are troubleshooting issues in a SELinux setting.

To fix the issue at hand, run:

# restorecon -R /var/www

as root. This will restore /var/www's context as determined by SELinux's system policy to /var/www and all folders and files below it.

Further information on (troubleshooting) SELinux can be found here, here and here.

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.