httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From D Kelmi <mik...@laudlink.ru>
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 [mailto:miksir@laudlink.ru]
>>
>> >   Try this (notice two NameVirtualHost directives):
>> > NameVirtualHost empty.somedomain.com
>> > NameVirtualHost www.somedomain.com

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 1.2.3.4>
>>>      DocumentRoot ...
>>>      ServerName www.somedomain
>>> </VirtualHost>
>>> 
>>>    But now for 1.2.3.4 run _ip-based_ virtual hosting. As result, for
>>>    requests to 1.2.3.4 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 1.2.3.4 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 1.2.3.4 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 1.2.3.4
BO> <VH 1.2.3.4>
BO>   ServerName dummy
BO>   DocumentRoot /path/to/default/site
BO> </VH>
BO> <VH 1.2.3.4>
BO>   ServerName site_1
BO>   DocumentRoot /path/to/site_1
BO> </VH>
BO> <VH 1.2.3.4>
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:
NameVirtualHost 1.2.3.4
<VH *>
  ServerName site1
</VH>
<VH 1.2.3.4>
  ServerName site2
</VH>

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

-- 
Best regards,
 D Kelmi                         mailto:miksir@laudlink.ru


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