Virtual Hosting Problems

Lucas Peet sirsky at lucastek.com
Wed Apr 16 19:02:46 CDT 2003


> I don't see how this will work for virtual names. Ever.
>> <VirtualHost *>
>>    DocumentRoot /home/http/default
>>    .....
>> </VirtualHost>

Think of the asterisks as 'all inclusive'.  'NameVirtualHost *' would
mean "don't bother whith the IP address or port - consider all virtual
hosts equal."  With that in mind, when apache receives a request, since
there is no definite virtual host, it compares the ServerName and
ServerAlias with the HTTP header (which contains the URL the user put in
his address bar), and when finding a match, it serves up the page.

It's not as much of an issue now as it was 5-8 years ago, but Name based
virtual hosting will NOT work with browsers earlier than 3.0.  This goes
with Netscape AND IE.  Of course, that was when IP addresses were more
plentiful and people could afford to use IP based virtual hosting...

The only time you should ever use actual IP addresses in a virtual host
configuration is when you're doing IP based virtual hosting, have a
large block of IP addresses to assign each virtual host it's own IP, and
have eth0 assigned a virtual IP as well.

So...with that in mind...

NameVirtualHost *

<VirtualHost *>
	ServerName www.domain.com
	ServerAlias domain.com
	DocumentRoot ...
</VirtualHost>

...is the way to go.

-Lucas

-----Original Message-----
From: owner-kclug at marauder.illiana.net
[mailto:owner-kclug at marauder.illiana.net] On Behalf Of Brian Densmore
Sent: Wednesday, April 16, 2003 10:56 AM
To: kclug at kclug.org; jose sanchez
Subject: RE: Virtual Hosting Problems

What do the DNS entries look like for these domains?
I like to run a local dns on the same box as my server.
Also try adding the port numbers to the names.

<VirtualHost www.kcmultiservice.com:80>
   ServerName www.kcmultiservice.com
   .....
</VirtualHost>
...

I don't see how this will work for virtual names. Ever.
> <VirtualHost *>
>    DocumentRoot /home/http/default
>    .....
> </VirtualHost>




More information about the Kclug mailing list