> >On 27.06.06 14:31, Neil A. Hillard wrote: > >> No, the VirtualHost entry tells Apache _where to listen_ for the request > >> and nothing else. > On 6/27/06, Matus UHLAR - fantomas <uhlar@xxxxxxxxxxx> wrote: > >That is, what docs says and how I understand it. On 29.06.06 18:04, Brian Rectanus wrote: > I was curious as well as to *why* this is the way it is, so I looked > in the source... > > This is intended for some reason or another. In the source, the > <VirtualHost> name is searched first (in order of appearance in conf > file) and returns a match before ServerName/Alias is even tried. > There is even a comment in the source stating that "If this is a > NameVirtualHost then we may not be doing the Right Thing". So you > could argue a bug, but this goes all the way through to 2.2.2 so it > will never be changed, heh. I always thought it's a bug ;) Of course the judgement is not on me. I guess, this functionality was created to make name-vhost configurations like this one: ### NameVirtualHost "host1" <VirtualHost "host1"> DocumentRoot /home/host1 </VirtualHost> <VirtualHost "host2"> DocumentRoot /home/host2 </VirtualHost> ### ...work, where "host1" and "host2" point to the same address, e.g. to make the move from ip-based to name-based vhosts a bit easier by avoiding the need of using ServerName/ServerAlias. But that's just my guess, based on config file I saw some time ago. > So, as previously stated, just always configure your VH with > ServerName same as <VirtualHost> tag as the *first* one in the file. > This will work fine. It won't work the desired way - as I said before, I want to have virtual hosts that only applies to non-existing names... > As for patching (not recommended), you could change > ap_matches_request_vhost in http_vhost.c to run the matches_aliases > before the VirtualHost name matches. Or possibly to remove the VirtualHost names match at all? Or do it only if no ServerName/ServerAlias is defined? Do you think that could break anything? (my problem is that thhe check is done at all). ### However: I found out this dirty workaround: 1. put default.fantomas.sk to /etc/hosts: 196.168.3.66 fantomas.fantomas.sk default.fantomas.sk (default.fantomas.sk is "virtual" name - it's designed not to exist in DNS, fantomas.fantomas.sk is main host name and for reverse mapping it must be the first, otherwise other apps may comply) 2. use "NameVirtualHost default.fantomas.sk" directive 3. define virtualhosts on this fake host This way it works as desired, and it also works, if other hosts then defauilt have "fantomas.fantomas.sk" or "195.168.3.66" in <VirtualHost>, as long as there is in NameVirtualHost with the same value. ### *This way it works NameVirtualHost default.fantomas.sk:80 # and also #NameVirtualHost fantomas.fantomas.sk:80 <VirtualHost default.fantomas.sk:80> ServerName default.fantomas.sk DocumentRoot /home/webs/default.fantomas.sk </VirtualHost> <VirtualHost default.fantomas.sk:80> # or also #<VirtualHost fantomas.fantomas.sk:80> ServerName fantomas.fantomas.sk DocumentRoot /home/webs/fantomas.fantomas.sk </VirtualHost> <VirtualHost default.fantomas.sk:80> # or also #<VirtualHost fantomas.fantomas.sk:80> ServerName 195.168.3.66 DocumentRoot /home/webs/195.168.3.66 </VirtualHost> ### END *This Once recommended way - using * (even *:80) for default.fantomas.sk, does NOT work, virtual host "default.nextra.sk" will never get matched. That way fantomas.fantomas.sk and 195.168.3.66 match, and the default is the first one of them. Note I want these hosts only at _one_ IP address, so using "*" for _all_ hosts is not possible. ### *This does NOT work NameVirtualHost *:80 <VirtualHost *:80> ServerName default.fantomas.sk DocumentRoot /home/webs/default.fantomas.sk </VirtualHost> NameVirtualHost 195.168.3.66:80 <VirtualHost 195.168.3.66:80> ServerName 195.168.3.66 DocumentRoot /home/webs/195.168.3.66 </VirtualHost> <VirtualHost 195.168.3.66:80> ServerName fantomas.fantomas.sk DocumentRoot /home/webs/fantomas.fantomas.sk </VirtualHost> ### END *This Well, At least I know how to workaround this issue. I will post comments to bug 39910... -- Matus UHLAR - fantomas, uhlar@xxxxxxxxxxx ; http://www.fantomas.sk/ Warning: I wish NOT to receive e-mail advertising to this address. Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu. Fucking windows! Bring Bill Gates! (Southpark the movie) --------------------------------------------------------------------- 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@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx