httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil A. Hillard" <>
Subject Re: [users@httpd] (again) Can not define "default" name virtual host
Date Tue, 27 Jun 2006 13:31:33 GMT

Matus UHLAR - fantomas wrote:
> On 27.06.06 13:30, Neil A. Hillard wrote:
>> I don't understand what the problem is here.  I've tested the
>> configuration suggested and it works fine (OK, I had to change the IP
>> address to match my setup):
>> <VirtualHost>
>>  ServerName
>>  DocumentRoot /home/webs/
>> </VirtualHost>
>> <VirtualHost>
>>  ServerName
>>  DocumentRoot /home/webs/
>> </VirtualHost>
> The problem is, that "" does not exist:
> Host not found: 3(NXDOMAIN)
> It has to be default name virtual host on this IP - the catch-all for all
> hosts not defined not listed in config file (e.g.
> or
> 1151413212 - 200 20 5 - "/" "-" "-"
> 1151413489 - 200 20 4 - "/" "-" "-"
> this is the log format:
> %{%s}t %v %V %{Host}o %{Host}i %a %h %>s %b %T %u \"%U\" \"%{Referer}i\" \"%{User-Agent}i\""
> The reply has to be like "No server is configured at this address", while
> reply for "" should be the std. page I configured.
> The problem currently is, request for falls here :(
>> You have made sure you've got a NameVirtualHost set?
> Yes.
>> When not supplying a 'Host:' header or supplying the IP address in the
>> 'Host:' header then Apache responds using the first virtual server but
>> if the name '' is used then the second one is used.
> Yes.
> But nobody should request "" (except me and other people
> looking at this problem). People may put into their browser and
> get to virtual host for - I make this server for people unable
> to use DNS resolution.
> But if anybody points any hostname to, it should go to
> "" (actually I can use any other name except
> and tell people "go away, the server you
> asked for does not exist".
> The pages you pointed me at (and also their 1.3 equivalent) say:
> <CITE>
> Now when a request arrives, the server will first check if it is using an IP
> address that matches the NameVirtualHost. If it is, then it will look at
> each <VirtualHost> section with a matching IP address and try to find one
>                                   ^^^^^^^^^^^^^^^^^^^
> where the ServerName or ServerAlias matches the requested hostname. If it
>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> finds one, then it uses the configuration for that server. If no matching
> virtual host is found, then the first listed virtual host that matches the
> IP address will be used.
> </CITE>
> They only say, that the requested host name should match ServerName and
> ServerAlias. But, when the name provided in <VirtualHost> matches the name
> requested, the virtual host matches too.

No, the VirtualHost entry tells Apache _where to listen_ for the request
and nothing else.  The VirtualHost must match the IP:port combination of
the request in order for that virtual host to stand a chance of
receiving the request.

You are trying to do something that Apache is not designed for.  You want:         -> /home/webs/ -> /home/webs/
<everything else>    -> /home/webs/

You can't do that.  You can do: -> /home/webs/
<everything else>    -> /home/webs/

end of story.  Apache doesn't do it and unless you write a patch then I
suspect no one else will.

This is not a bug but the way it works.  Now I'm pretty sure you could
use mod_rewrite to work around this but you're on your own for that.


Neil Hillard          
Westland Helicopters Ltd.

Disclaimer: This message does not necessarily reflect the
            views of Westland Helicopters Ltd.

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