httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leif W" <warp-...@usa.net>
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 www.mainhost.com
> NameVirtualHost 11.22.33.44
>
> then
>
> <VirtualHost 11.22.33.44>
>        DocumentRoot /home/ftphome/thisismytest.com/www
>        ServerName www.thisismytest.com
>        ServerAlias thisismytest.com
>        ErrorLog /var/log/domains/thisismytest.com/error_log
>        CustomLog /var/log/domains/thisismytest.com/access_log 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.

Leif



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message