httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Weaver <t...@m2n.com>
Subject Re: [users@httpd] Virtual Hosts
Date Wed, 24 Mar 2004 19:25:19 GMT
On Wed, Mar 24, 2004 at 07:10:28PM +0000, Matthew Williamson wrote:
> 192.168.0.2 pentium pentium.localdomain localhost
> 127.0.0.1 www.reays.com reays.localdomain localhost
> 127.0.0.1 www.testbox.com testbox.localdomain localhost
> 192.168.0.1 www.linuxbox.com 
> 
> Is it that I have something wrong in my hosts file, or should I be
> looking at my http.conf to change my virtual host settings?

VirtualHosts are sequentially read.
And if there is no match for VirtualHosts to distinguish which one
you're wanting to use, the first is used.

Your example:
<VirtualHost 192.168.0.2:80>
        ServerName pentium.localdomain.com
        ...
</VirtualHost>

<VirtualHost 192.168.0.2:80>
        ServerName reays.localdomain.com
        ...
</VirtualHost>

<VirtualHost 192.168.0.2:80>
        ServerName third.localdomain.com
        ...
</VirtualHost>

if you request:
http://192.168.0.2/
You will get the first VirtualHost, because httpd cannot
distinguish which one you 'really' want.

The common distinguishing factor is ServerName.
so if you request:
http://reays.localdomain.com/
(and have that setup in your hosts properly to point
 to your httpd server!)
You would get the second VirtualHost,
since httpd CAN distinguish which
one you 'really' wanted.

1. So you most likely need to change your VirtualHosts
   to include ServerName.
2. You most likely need to change your host file to point
   to pentium for each ServerName.
3. And you would most likely want to change your request
   url from IP address based, to named based.

Todd.

---------------------------------------------------------------------
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