httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matus UHLAR - fantomas <uh...@fantomas.sk>
Subject Re: [users@httpd] Re: Server default vhost
Date Fri, 04 Nov 2011 10:35:19 GMT
>> > I unsuccessfully tried numerous variations of NameVirtualHost,
>> > VirtualHost and ServerName but apache either serves www.domain.tld
>> > or 192.168.0.1 for all requests.

>Steve Swift wrote:
>> Once you have your Virtualhosts setup, the first one becomes the
>> default for any requests which do not match the
>> ServerName/ServerAlias in any other Virtualhost.

On 04.11.11 08:09, Helmut Schneider wrote:
>But - both www.domain.tld and 192.168.0.1 match the same vhost (at
>least what I observed). I want both to match different vhosts.

then you must define two virtual hosts.

NameVirtualHost 192.168.0.1

<VirtualHost 192.168.0.1>
ServerName 192.168.0.1
</VirtualHost>

<VirtualHost 192.168.0.1>
ServerName www.domain.tld
</VirtualHost>

Note that you can not replace those two <VirtualHost> sections, since a 
feature (hidden in virtualhost matching docs) causes the string in 
<VirtualHost> be a hidden server alias for it, therefore each of those 
virtual hosts has a hidden alias of 192.168.0.1:

<VirtualHost 192.168.0.1> // means hidden ServerAlias 192.168.0.1

... replacing those would create first (default) host with name  
www.domain.tld and hidden alias 192.168.0.1 which would be the default 
virtual hsot for IP 192.168.0.1

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; 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.
Silvester Stallone: Father of the RISC concept.

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