Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Default V-host


  • From: Mark Mentovai <mark-list@xxxxxxxxxxxx>
  • Subject: Re: Default V-host
  • Date: Sun, 14 Jul 2002 10:04:25 -0400

Chris Knipe wrote:
> What's the correct format / way to configure a default v-host?
> 
> I've set my basic server up, and a few v-hosts, and at the end of the
> apache
> config, I added
> 
> <VirtualHost _default_:80>
> ...
> </VirtualHost>
> 
> According to the apache docs, this should catch all hosts on port 80.

It catches everything directed to port 80 of IP addresses not 
configured for other virtual hosts.

> However, when I send a request to the IP address of the server on
> port 80, I
> end up going to the first v-host I have configured.

It sounds like you're using NameVirtualHost.  Apache will find and use 
one of the virtual host definitions for the IP address and port you are 
using, and will not need to fall back on _default_:80.

> How do I get this to work right?

Apache always uses the first virtual host configured for a specific IP 
address and port as the "default" if no Host field is supplied by the 
client, or if the Host field does not match any ServerName or 
ServerAlias.  You need to list what you want to be the default by IP 
address, and place it before other virtual hosts sharing the same 
address in the configuration.

NameVirtualHost 192.0.2.1
<VirtualHost 192.0.2.1:80>
  # "default virtual host"
</VirtualHost>
<VirtualHost 192.0.2.1:80>
  ServerName www.virtual-host-1.example.com
</VirtualHost>
<VirtualHost 192.0.2.1:80>
  ServerName www.virtual-host-2.example.com
</VirtualHost>

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx