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

I am trying to set up a couple ov VritualHost in my Apache, but I would like to put the DocumentRoot of these virtual host on folders outside the basic www folder. It happens that I get alwasy "Permission Denied". My httpd.conf follows: NameVirtualHost *:80

         <VirtualHost *:80>
              ServerAdmin webmaster@dummy-host.example.com
              DocumentRoot /home/giuseppe/www

              ServerName www.example.com/www
              ErrorLog logs/host.www.projects-error_log
              CustomLog logs/dummy-host.example.com-access_log common

         <Directory "/home/giuseppe/www">
             Options Indexes FollowSymLinks
             AllowOverride All
             Order allow,deny
             Allow from all
         </Directory>

         </VirtualHost>


        <VirtualHost *:80>
             ServerAdmin webmaster@dummy-host.example.com
             DocumentRoot /home/developper

             ServerName www.example.com
             ErrorLog logs/host.developper-error_log
             CustomLog logs/dummy-host.example.com-access_log common
        </VirtualHost>

EDIT:

I tried to change the user group permission to www folder. But no success. I think the problem is ServerName.

 VirtualHost A
  ServerName www.example.com

 VirtualHost B
  Servername www.example.com/www

Maybe ServerName must be a valid DNS? Like www.example.com and site2.example.com, and not a simple

share|improve this question
    
Where are your docs stored? How are you linking the docs? With a symlink? although you have FollowSymLinks you may need another <Directory> defintion to allow access to those files. –  Drav Sloan Jun 24 '11 at 15:28
add comment

migrated from stackoverflow.com Jun 25 '11 at 13:39

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

1 Answer

You can put your DocumentRoot where you want, no special restrictions on that.

So as stated by the error message your problem is only with file & directories rights.

The apache user must be able to walk to these documentRoots and to read files there. So you should adjust several things:

  • check that either the apache user or group as read access on directories and files inside this directory
  • check that he's got the execution right on all parents directories
  • check that you do not have SELinux or such security tools adding some more constraints (check the apache logs and system logs)
share|improve this answer
add comment

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.