httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leif W" <>
Subject Re: [users@httpd] NameVirtualHost not working
Date Thu, 03 Feb 2005 09:08:05 GMT
> Bryan Koschmann - GKT; 2005 February 02 Wednesday 19:58
> I'm trying to setup a webserver using apache 2.0.52 and virtual hosts.
> In my config I have:
> ServerName
> NameVirtualHost
> then
> <VirtualHost>
>        DocumentRoot /home/ftphome/
>        ServerName
>        ServerAlias
>        ErrorLog /var/log/domains/
>        CustomLog /var/log/domains/ combined
> </VirtualHost>
> however, when I run that, it points the main site to the new virtual
> directory. I just can't figure out why it will not work.

Check the manual on virtual hosts and NBVH.

Once you start using a single VirtualHost container, then the "main 
config" ServerName will never ever be shown.  The behavior of the 
VirtualHost stuff is such that for Name Based Virtual Hosting, if a 
user-agent's "Host" header does not match a ServerName or ServerAlias of 
any of the defined VirtualHost sections, then it just uses the first 
VirtualHost, and NOT the ServerName from the main config.

If you define Alias-es and assosciated Directory-s in the main config, 
these will be inherited by all the VirtualHosts by default.  For 
example, /manual .  You may want to comment out the /manual Alias and 
Directory, or do as I do, and put it into a separate conf file, and 
Include only into a local-only accessibleVirtualHost container.  If not, 
robots tend to archive /manual and it ends up in search engines.

Also, you might want to start the habit of appending the specific port 
( ":port" or ":80" ) to all Listen, NameVirtualHost, and ServerName 
directives.  I had some issues arise by not specifying the ports with 
non-standard ports (port != 80 && port != 443).  They went away with the 
ports specified everywhere.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message