Example: The document root of virtualHost is /var/www, and server name is "aaa.com". However, apache will tell my forbidden if I access the server with "localhost" and "aaa.com". If I change the Directory option in http.conf to "/var/www", apache will work well. I don't know why? and I want to set Directory option in every httpd-vhosts.conf, not in httpd.conf, how I can do it?

http.conf: enter image description here

httpd-vhosts.conf:enter image description here

share|improve this question
    
You have a mistype in http.conf - <Directory "/var/Wwww/"> (4 w`s) – s.webbandit May 4 '12 at 11:38
    
you should have a default host and the extra virtual host settings with their own DocumentRoot and other own settings. If these settings are after each other, what's the problem? You could be more specific, your question is a bit unclear to me. So, what if you put the "default" host settings to the file httpd-vhosts.conf, AND after that, you put the other VirtualHost settings too. EDIT: oh yeah, I just saw webbandit's comment, he's absolutely right. – Sk8erPeter May 4 '12 at 12:00
up vote 10 down vote accepted

In http.conf file you should define options for only <Directory />. All the options of VirtualHosts you should define in httpd-vhosts.conf files. Something like:

httpd.conf:

DocumentRoot "/var/www"

<Directory />
        Order deny,allow
        Deny from all
        Options None
        AllowOverride None
</Directory>

httpd-vhosts.conf:

ServerName aaa.com
DocumentRoot /var/www

<Directory /var/www>
        Options FollowSymLinks Includes
        AllowOverride All
        Order allow,deny
        Allow from all
</Directory>
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.