httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boyle Owen" <>
Subject RE: Re[2]: [users@httpd] NameVirtualHost * with <VirtualHost IP>
Date Fri, 05 Dec 2003 08:27:37 GMT
> -----Original Message-----
> From: D Kelmi []
> >   Try this (notice two NameVirtualHost directives):
> > NameVirtualHost
> > NameVirtualHost

First, can we correct the advice posted earlier. NameVirtualHost should
take an IP address as an argument - not a fully-qualified domain name.
If you give it an FQDN, it will "work" but only because apache resolves
the name to its IP. If you have any DNS problems, apache could fail to

To return to your misconfiguration problem; 

>> NameVirtualHost *
>> <VirtualHost *>
>>      DocumentRoot ...
>>      ServerName empty.somedomain
>> </VirtualHost>
>> <VirtualHost>
>>      DocumentRoot ...
>>      ServerName www.somedomain
>> </VirtualHost>
>>    But now for run _ip-based_ virtual hosting. As result, for
>>    requests to always answer second virtualhost.

IP-based VHs supersede name-based VHs so the apache behaviour you see is
exactly correct. Not a bug. 

>>    And more, if
>>    i add third virtualhost this IP, apache generate warning
>>    about overlaps.

Of course it does. How is apache supposed to decide which VH to use if
they both have the same IP address? It is like you have two letter-boxes
with the same name on them. How can the postman decide which one to use?

>>    I think, that's wrong, because NameVirtualHost * say, what for
>>    all IP run name-based virtual hosting.

You are assuming that NameVirtualHost will take priority and that the
IP-based VH will live inside it somehow. If you think about it, that is

You do not tell us how many IP addresses you have on your server. If
only one, then I guess you are trying to achieve the following:

	if hostname is set in request, do name-based VHing
	use IP-VHing

The way to set that up is as follows:

  ServerName dummy
  DocumentRoot /path/to/default/site
  ServerName site_1
  DocumentRoot /path/to/site_1
  ServerName site_2
  DocumentRoot /path/to/site_2

If the request matches site_1 or site_2, it will be served from the
correct VH. If it doesn't match, or doesn't contain a hostname, apache
will fall-back to the *first* VH in the list, which is the "dummy" site.

If you have many IP addresses, then simply separate them:

# IP-based site
  ServerName ip_site
  DocumentRoot /path/to/default/site

# name-based sites
  ServerName site_1
  DocumentRoot /path/to/site_1
  ServerName site_2
  DocumentRoot /path/to/site_2

Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 

Diese E-mail ist eine private und persönliche Kommunikation. Sie hat
keinen Bezug zur Börsen- bzw. Geschäftstätigkeit der SWX Gruppe. This
e-mail is of a private and personal nature. It is not related to the
exchange or business activities of the SWX Group. Le présent e-mail est
un message privé et personnel, sans rapport avec l'activité boursière du
Groupe SWX.

This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please notify the sender urgently
and then immediately delete the message and any copies of it from your
system. Please also immediately destroy any hardcopies of the message.
You must not, directly or indirectly, use, disclose, distribute, print,
or copy any part of this message if you are not the intended recipient.
The sender's company reserves the right to monitor all e-mail
communications through their networks. Any views expressed in this
message are those of the individual sender, except where the message
states otherwise and the sender is authorised to state them to be the
views of the sender's company. 

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