httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From D Kelmi <>
Subject Re[4]: [users@httpd] NameVirtualHost * with <VirtualHost IP>
Date Fri, 05 Dec 2003 08:48:15 GMT
Hello Boyle,

Friday, December 5, 2003, 11:27:37 AM, you wrote:

>> -----Original Message-----
>> From: D Kelmi []
>> >   Try this (notice two NameVirtualHost directives):
>> > NameVirtualHost
>> > NameVirtualHost

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

  NameVirtualHost also can take * as argument for match all addresses.

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

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

   Why? I say in NameVirtualHost what my all IP addresses must support
   name-based virtual hosting. And now Apache must look all VHs with
   the same IP (same with request destination) and also look VHs with
   * (VHs which support any request destination). Right?

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

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

    Again, I say, what used for name-based hosting and apache
    must select VHs using Host: header and ServerName/ServerAlias
    directives in VH.

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

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

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

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

BO> The way to set that up is as follows:

BO> NameVirtualHost
BO> <VH>
BO>   ServerName dummy
BO>   DocumentRoot /path/to/default/site
BO> </VH>
BO> <VH>
BO>   ServerName site_1
BO>   DocumentRoot /path/to/site_1
BO> </VH>
BO> <VH>
BO>   ServerName site_2
BO>   DocumentRoot /path/to/site_2
BO> </VH>
BO> etc.

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

Ok. Now say, which VHs will be "dummy" in this example:
<VH *>
  ServerName site1
  ServerName site2

Which? site1 or site2? I think, what site1, because <VH *> match IP also. Apache think, what site2.

Best regards,
 D Kelmi               

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