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.

originally i had the virtual host inside /var/www/dir which worked well.

However, i wanted to separate this site from the other, so i create /var/www2/

i set DocumentRoot to /var/www2/

now when i navigate to the new site, it throws 403 Forbidden error.

share|improve this question

4 Answers 4

Have you checked the permissions and ownership on the /var/www2 directory? There ought to be errors in the error log that will give you a better idea of what's going on.

share|improve this answer

Did you set up permissions within your VirtualHost directive:

<Directory /var/www2>
    Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
</Directory>

Also as Hans mentioned, check your permissions on that directory. It must be readable by the User and Group the Apache server is running under.

share|improve this answer

As Hans mentioned, check permissions, the directory should at least be group owned by the user running apache and have the execute bit set. You would probably have it set for world/other read and execute (chmod o+rx /var/www2).

Additionally, you should verify that SELinux isn't complaining about /var/www2 being set to the wrong context. In either case, you should see errors in your error_log file telling you exactly what the problem is.

share|improve this answer

You might want to create your vhost in /var/www/anotherdir as apache doesn't have SELinux permissions by default to serve files outside of that directory structure if I recall correctly. You can use ls -Z /var/www /var/www2 to see the SELinux security context information for those directories. If you are getting SELinux permission denied errors you'll see them in the /var/log/audit/audit.log. If you do move /var/www2 into /var/www you may wish to use restorecon -R /var/www to reset the security context of your files based on its rules.

share|improve this answer

Your Answer

 
discard

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