You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Matus UHLAR - fantomas <uh...@fantomas.sk> on 2006/06/26 08:42:42 UTC
[users@httpd] (again) Can not define "default" name virtual host
Hello,
this is my current configuration of apache (debian: 1.3.33-6sarge1):
NameVirtualHost 195.168.3.66:80
<VirtualHost 195.168.3.66:80>
ServerName default.fantomas.sk
DocumentRoot /home/webs/default.fantomas.sk
</VirtualHost>
<VirtualHost 195.168.3.66:80>
ServerName fantomas.fantomas.sk
DocumentRoot /home/webs/fantomas.fantomas.sk
</VirtualHost>
<VirtualHost 195.168.3.66:80>
ServerName 195.168.3.66
DocumentRoot /home/webs/195.168.3.66
</VirtualHost>
However, with this configuration I was not able to reach virtual host
195.168.3.66. It seems that apache accepts name defined in
<VirtualHost [NAME]> as one of hames for name virtual host -
when I switched to <VirtualHost fantomas.fantomas.sk>, I couldn't reach
virtual host for fantomas.fantomas.sk.
I can not simply use <VirtualHost *> because of different virtual servers
running at different IP addresses. Also, at other sites I'm configuring
apache from databases that contain server-IP pairs, configuring given server
at given IP, and exporting this configuration to DNS.
Can anyone confirm this behaviour? Can anyone explain to my, why was
name-based virtual hosting made this way?
I guess it was because of possibility of simple configuration of virtual
hosts way I noticed in one config some time ago:
###
NameVirtualHost [IP]
<VirtualHost first.server.name>
DocumentRoot /server/first
</VirtualHost>
<VirtualHost second.server.name>
DocumentRoot /server/second
</VirtualHost>
###
- defining virtual hosts without ServerName and/or ServerAlias directives.
Can anyone advise me, what could I change in source code to make it work the
expected (and documented) way - only using labels in ServerName and
ServerAlias in virtual hosts?
Thank you.
--
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.
He who laughs last thinks slowest.
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 27.06.06 13:25, Pid wrote:
> The documentation says:
>
> "ServerName fully-qualified-domain-name[:port]"
>
> so you might be falling at the first hurdle, because you're not
> specifying a FQDN.
>
> Also:
>
> "If no ServerName is specified, then the server attempts to deduce the
> hostname by performing a reverse lookup on the IP address.
seems that not only if ServerName is specified - seems it does that always.
--
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.
The 3 biggets disasters: Hiroshima 45, Tschernobyl 86, Windows 95
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Pid <p...@pidster.com>.
Matus UHLAR - fantomas wrote:
>> Your problem here is that the ServerName requires a fully-qualified
>> domain name, rather than an IP address.
>
> I think that ServerName could contain anything that users may request in the
> Host: header ;-)
Yes, I'd gathered that you think it ought to do something other than
what it does do.
> The documentation (somehow) says that virtual host applies, if the requested
> name matches ServerName or ServerAlias. What I show here is, that it matches
> even if the requested name matches the "name" defined in
> <VirtualHost "name"> which is not documented (and causes problems to me).
The documentation says:
"ServerName fully-qualified-domain-name[:port]"
so you might be falling at the first hurdle, because you're not
specifying a FQDN.
Also:
"If no ServerName is specified, then the server attempts to deduce the
hostname by performing a reverse lookup on the IP address. If no port is
specified in the ServerName, then the server will use the port from the
incoming request. For optimal reliability and predictability, you should
specify an explicit hostname and port using the ServerName directive."
So in your case it may actually be resolving fantomas.fantomas.sk, if
it's deciding that the IP doesn't count as a ServerName. This may,
however, be completely irrelevant.
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
> > In this case, no requests will reach "default.fantomas.sk" (this name does
> > not exist) because 195.168.3.66 will be default host. And the thing is I
> > want to differentiate between those...
On 27.06.06 13:06, Pid wrote:
> So you want to return default.fantomas.sk in all cases where the IP
> address or another ServerName is not defined?
Yes, for everything that does not exist. 195.168.3.66 and
fantomas.fantomas.sk do exist and they should return something I configure,
everything else should go to "default.fantomas.sk"
> Your problem here is that the ServerName requires a fully-qualified
> domain name, rather than an IP address.
I think that ServerName could contain anything that users may request in the
Host: header ;-)
(and there are some historical cases where IP's are called directly)
> It serves the default host when
> it can't decide which to pick, this would include an IP address.
>
> I don't think there's a bug, or even an undocumented behaviour.
The documentation (somehow) says that virtual host applies, if the requested
name matches ServerName or ServerAlias. What I show here is, that it matches
even if the requested name matches the "name" defined in
<VirtualHost "name"> which is not documented (and causes problems to me).
--
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.
Posli tento mail 100 svojim znamim - nech vidia aky si idiot
Send this email to 100 your friends - let them see what an idiot you are
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Pid <p...@pidster.com>.
Matus UHLAR - fantomas wrote:
>>> afaik the server does not resolve IP's to hosts here (do you have other
>>> informations?)
>>
>> <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 default.fantomas.sk
>> DocumentRoot /home/webs/default.fantomas.sk
>> </VirtualHost>
>
> In this case, no requests will reach "default.fantomas.sk" (this name does
> not exist) because 195.168.3.66 will be default host. And the thing is I
> want to differentiate between those...
So you want to return default.fantomas.sk in all cases where the IP
address or another ServerName is not defined?
Your problem here is that the ServerName requires a fully-qualified
domain name, rather than an IP address. It serves the default host when
it can't decide which to pick, this would include an IP address.
I don't think there's a bug, or even an undocumented behaviour.
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
> > afaik the server does not resolve IP's to hosts here (do you have other
> > informations?)
On 27.06.06 10:22, Pid wrote:
> I didn't say anything about *DNS* resolution.
Aha, sorry. I understand what you've meant.
> > requests for "195.168.3.66" should go to virtualhost "195.168.3.66" if they
> > come to the same address the virtual host is defined at, afaik no DNS
> > resolution applies here.
>
> Yes, you're probably right. But it doesn't, for reasons which I can only
> guess at.
and this is it, I've already come to this explanation.
> > The only place where DNS resolution applies, is where I define:
> >
> > <VirtualHost fantomas.fantomas.sk:80> <--- here
> Umm, wha?
when apache loads its config, it will resolve fantomas.fantomas.sk to its IP
address and works with the IP. But as long as we bnoth didn't talk about DNS
resolution, this is irelevant...
> > in which case I can't have virtual host for "fantomas.fantomas.sk" because
> > it would fall into this one :-(
>
> You didn't say that, you said:
[deleted]
> And I'm suggesting that the following will resolve your problem.
>
> <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 default.fantomas.sk
> DocumentRoot /home/webs/default.fantomas.sk
> </VirtualHost>
In this case, no requests will reach "default.fantomas.sk" (this name does
not exist) because 195.168.3.66 will be default host. And the thing is I
want to differentiate between those...
--
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.
They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety. -- Benjamin Franklin, 1759
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Pid <p...@pidster.com>.
Matus UHLAR - fantomas wrote:
> On 27.06.06 09:34, Pid wrote:
>> Matus UHLAR - fantomas wrote:
>>> On 26.06.06 16:45, Pid wrote:
>>>> It maps there because it's the first in the list.
>>> Pardon? My problem is that request for "195.168.3.66" goes to
>>> "default.fantomas.sk" although "195.168.3.66" has its own virtual host.
>> Yes, I was quite clear on that and I think that I've offered a solution.
>>
>> I think that the server is not resolving the IP to the ServerName you
>> specify, because you are specifying the IP in the VirtualHost directive.
>
> afaik the server does not resolve IP's to hosts here (do you have other
> informations?)
I didn't say anything about *DNS* resolution.
>> Instead, because it can't match VirtualHost it's selecting the default
>> VirtualHost, which is always the first one defined in the list of
>> VirtualHosts.
>
> requests for "195.168.3.66" should go to virtualhost "195.168.3.66" if they
> come to the same address the virtual host is defined at, afaik no DNS
> resolution applies here.
Yes, you're probably right. But it doesn't, for reasons which I can only
guess at.
> The only place where DNS resolution applies, is where I define:
>
> <VirtualHost fantomas.fantomas.sk:80> <--- here
> ServerName 195.168.3.66
> DocumentRoot /home/webs/195.168.3.66
> </VirtualHost>
Umm, wha?
> in which case I can't have virtual host for "fantomas.fantomas.sk" because
> it would fall into this one :-(
You didn't say that, you said:
<VirtualHost 195.168.3.66:80>
ServerName default.fantomas.sk
DocumentRoot /home/webs/default.fantomas.sk
</VirtualHost>
<VirtualHost 195.168.3.66:80>
ServerName fantomas.fantomas.sk
DocumentRoot /home/webs/fantomas.fantomas.sk
</VirtualHost>
<VirtualHost 195.168.3.66:80>
ServerName 195.168.3.66
DocumentRoot /home/webs/195.168.3.66
</VirtualHost>
>> Ergo, your solution is to move the VirtualHost with 'ServerName
>> 195.168.3.66' to the first position in the list of VirtualHosts.
And I'm suggesting that the following will resolve your problem.
<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 default.fantomas.sk
DocumentRoot /home/webs/default.fantomas.sk
</VirtualHost>
<VirtualHost 195.168.3.66:80>
ServerName fantomas.fantomas.sk
DocumentRoot /home/webs/fantomas.fantomas.sk
</VirtualHost>
> That would mean that requests for "195.168.3.66" would go to the default
> virtual host which is also what I do not want.
>> Alternatively, if you specify NameVirtualHost *:80 and use VirtualHost
>> *:80 the 'ServerName 195.168.3.66' should properly select the correct
>> host. If you are operating different IPs tell this instance of Apache
>> to only Listen to this IP.
>
> and run different apache instances on different IPs? Yes, both would be a
> workaround, but I would prefer a solution.
>
> I looked at the code to find out what's wrong, but I am not a programmer
> (although I can code in C, it's not my work so I have nearly no practice).
>
> I would patch apache myself if I found the solution... this makes me a
>
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 27.06.06 09:34, Pid wrote:
> Matus UHLAR - fantomas wrote:
> > On 26.06.06 16:45, Pid wrote:
> >> It maps there because it's the first in the list.
> >
> > Pardon? My problem is that request for "195.168.3.66" goes to
> > "default.fantomas.sk" although "195.168.3.66" has its own virtual host.
>
> Yes, I was quite clear on that and I think that I've offered a solution.
>
> I think that the server is not resolving the IP to the ServerName you
> specify, because you are specifying the IP in the VirtualHost directive.
afaik the server does not resolve IP's to hosts here (do you have other
informations?)
> Instead, because it can't match VirtualHost it's selecting the default
> VirtualHost, which is always the first one defined in the list of
> VirtualHosts.
requests for "195.168.3.66" should go to virtualhost "195.168.3.66" if they
come to the same address the virtual host is defined at, afaik no DNS
resolution applies here.
The only place where DNS resolution applies, is where I define:
<VirtualHost fantomas.fantomas.sk:80> <--- here
ServerName 195.168.3.66
DocumentRoot /home/webs/195.168.3.66
</VirtualHost>
in which case I can't have virtual host for "fantomas.fantomas.sk" because
it would fall into this one :-(
> Ergo, your solution is to move the VirtualHost with 'ServerName
> 195.168.3.66' to the first position in the list of VirtualHosts.
That would mean that requests for "195.168.3.66" would go to the default
virtual host which is also what I do not want.
> Alternatively, if you specify NameVirtualHost *:80 and use VirtualHost
> *:80 the 'ServerName 195.168.3.66' should properly select the correct
> host. If you are operating different IPs tell this instance of Apache
> to only Listen to this IP.
and run different apache instances on different IPs? Yes, both would be a
workaround, but I would prefer a solution.
I looked at the code to find out what's wrong, but I am not a programmer
(although I can code in C, it's not my work so I have nearly no practice).
I would patch apache myself if I found the solution... this makes me a
--
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.
There's a long-standing bug relating to the x86 architecture that
allows you to install Windows. -- Matthew D. Fuller
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Pid <p...@pidster.com>.
Matus UHLAR - fantomas wrote:
> On 26.06.06 16:45, Pid wrote:
>> It maps there because it's the first in the list.
>
> Pardon? My problem is that request for "195.168.3.66" goes to
> "default.fantomas.sk" although "195.168.3.66" has its own virtual host.
Yes, I was quite clear on that and I think that I've offered a solution.
I think that the server is not resolving the IP to the ServerName you
specify, because you are specifying the IP in the VirtualHost directive.
Instead, because it can't match VirtualHost it's selecting the default
VirtualHost, which is always the first one defined in the list of
VirtualHosts.
Ergo, your solution is to move the VirtualHost with 'ServerName
195.168.3.66' to the first position in the list of VirtualHosts.
Alternatively, if you specify NameVirtualHost *:80 and use VirtualHost
*:80 the 'ServerName 195.168.3.66' should properly select the correct
host. If you are operating different IPs tell this instance of Apache
to only Listen to this IP.
>> If you want a VH to operate under the IP only, put it first.
>
> Pardon? I want one virtual host under "195.168.3.66", one under
> "fantomas.fantomas.sk" and default virtual host into which requests for
> undefined/unconfigured requests will fall. My problem is described above
> (and cocumented below).
>
> It seems that the name defined in <VirtualHost "name"> is also taken to one
> of aliases for virtual host, neither `httpd -S` does show it, nor the docs
> say so.
>
> I would like to find out why, and how to get the documented behaviour.
> (Joshua said he will try to look at it, good)
>
>>>> On 6/26/06, Matus UHLAR - fantomas <uh...@fantomas.sk> wrote:
>>>>> this is my current configuration of apache (debian: 1.3.33-6sarge1):
>>>>>
>>>>> NameVirtualHost 195.168.3.66:80
>>>>>
>>>>> <VirtualHost 195.168.3.66:80>
>>>>> ServerName default.fantomas.sk
>>>>> DocumentRoot /home/webs/default.fantomas.sk
>>>>> </VirtualHost>
>>>>>
>>>>> <VirtualHost 195.168.3.66:80>
>>>>> ServerName fantomas.fantomas.sk
>>>>> DocumentRoot /home/webs/fantomas.fantomas.sk
>>>>> </VirtualHost>
>>>>>
>>>>> <VirtualHost 195.168.3.66:80>
>>>>> ServerName 195.168.3.66
>>>>> DocumentRoot /home/webs/195.168.3.66
>>>>> </VirtualHost>
>>>>>
>>>>> However, with this configuration I was not able to reach virtual host
>>>>> 195.168.3.66. It seems that apache accepts name defined in
>>>>> <VirtualHost [NAME]> as one of hames for name virtual host -
>>>>> when I switched to <VirtualHost fantomas.fantomas.sk>, I couldn't reach
>>>>> virtual host for fantomas.fantomas.sk.
>
>>> LogFormat "%{%s}t %v %V %{Host}o %{Host}i %a %h %>s %b %T %u \"%U\" \"%{Referer}i\" \"%{User-Agent}i\"" testing
>>>
>>> 1151335141 default.fantomas.sk default.fantomas.sk - default.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
>>> 1151335149 default.fantomas.sk 195.168.3.66 - 195.168.3.66 195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
>>> 1151335157 fantomas.fantomas.sk fantomas.fantomas.sk - fantomas.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 21 5 - "/" "-" "-"
>>>
>>> so, with the above configuration, requesting of 195.168.3.66 maps to
>>> "default.fantomas.sk" virtual host...
>
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 26.06.06 16:45, Pid wrote:
> It maps there because it's the first in the list.
Pardon? My problem is that request for "195.168.3.66" goes to
"default.fantomas.sk" although "195.168.3.66" has its own virtual host.
> If you want a VH to operate under the IP only, put it first.
Pardon? I want one virtual host under "195.168.3.66", one under
"fantomas.fantomas.sk" and default virtual host into which requests for
undefined/unconfigured requests will fall. My problem is described above
(and cocumented below).
It seems that the name defined in <VirtualHost "name"> is also taken to one
of aliases for virtual host, neither `httpd -S` does show it, nor the docs
say so.
I would like to find out why, and how to get the documented behaviour.
(Joshua said he will try to look at it, good)
> >> On 6/26/06, Matus UHLAR - fantomas <uh...@fantomas.sk> wrote:
> >>> this is my current configuration of apache (debian: 1.3.33-6sarge1):
> >>>
> >>> NameVirtualHost 195.168.3.66:80
> >>>
> >>> <VirtualHost 195.168.3.66:80>
> >>> ServerName default.fantomas.sk
> >>> DocumentRoot /home/webs/default.fantomas.sk
> >>> </VirtualHost>
> >>>
> >>> <VirtualHost 195.168.3.66:80>
> >>> ServerName fantomas.fantomas.sk
> >>> DocumentRoot /home/webs/fantomas.fantomas.sk
> >>> </VirtualHost>
> >>>
> >>> <VirtualHost 195.168.3.66:80>
> >>> ServerName 195.168.3.66
> >>> DocumentRoot /home/webs/195.168.3.66
> >>> </VirtualHost>
> >>>
> >>> However, with this configuration I was not able to reach virtual host
> >>> 195.168.3.66. It seems that apache accepts name defined in
> >>> <VirtualHost [NAME]> as one of hames for name virtual host -
> >>> when I switched to <VirtualHost fantomas.fantomas.sk>, I couldn't reach
> >>> virtual host for fantomas.fantomas.sk.
> > LogFormat "%{%s}t %v %V %{Host}o %{Host}i %a %h %>s %b %T %u \"%U\" \"%{Referer}i\" \"%{User-Agent}i\"" testing
> >
> > 1151335141 default.fantomas.sk default.fantomas.sk - default.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
> > 1151335149 default.fantomas.sk 195.168.3.66 - 195.168.3.66 195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
> > 1151335157 fantomas.fantomas.sk fantomas.fantomas.sk - fantomas.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 21 5 - "/" "-" "-"
> >
> > so, with the above configuration, requesting of 195.168.3.66 maps to
> > "default.fantomas.sk" virtual host...
--
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.
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Pid <p...@pidster.com>.
It maps there because it's the first in the list.
If you want a VH to operate under the IP only, put it first.
Matus UHLAR - fantomas wrote:
>> On 6/26/06, Matus UHLAR - fantomas <uh...@fantomas.sk> wrote:
>>> this is my current configuration of apache (debian: 1.3.33-6sarge1):
>>>
>>> NameVirtualHost 195.168.3.66:80
>>>
>>> <VirtualHost 195.168.3.66:80>
>>> ServerName default.fantomas.sk
>>> DocumentRoot /home/webs/default.fantomas.sk
>>> </VirtualHost>
>>>
>>> <VirtualHost 195.168.3.66:80>
>>> ServerName fantomas.fantomas.sk
>>> DocumentRoot /home/webs/fantomas.fantomas.sk
>>> </VirtualHost>
>>>
>>> <VirtualHost 195.168.3.66:80>
>>> ServerName 195.168.3.66
>>> DocumentRoot /home/webs/195.168.3.66
>>> </VirtualHost>
>>>
>>> However, with this configuration I was not able to reach virtual host
>>> 195.168.3.66. It seems that apache accepts name defined in
>>> <VirtualHost [NAME]> as one of hames for name virtual host -
>>> when I switched to <VirtualHost fantomas.fantomas.sk>, I couldn't reach
>>> virtual host for fantomas.fantomas.sk.
>>>
>>> I can not simply use <VirtualHost *> because of different virtual servers
>>> running at different IP addresses. Also, at other sites I'm configuring
>>> apache from databases that contain server-IP pairs, configuring given
>>> server
>>> at given IP, and exporting this configuration to DNS.
>>>
>>> Can anyone confirm this behaviour? Can anyone explain to my, why was
>>> name-based virtual hosting made this way?
>
> On 26.06.06 09:49, Joshua Slive wrote:
>> I'm fairly sure you are incorrect in your interpretation, although
>> there is no way I'm going to load up a 1.3 server to test with.
>>
>> To see what is really going on, add %{Host}o and %v to your LogFormat
>> to see what apache is seeing and how it is interpreting it.
>
> I think you've meant %{Host}i, but I added both:
>
> LogFormat "%{%s}t %v %V %{Host}o %{Host}i %a %h %>s %b %T %u \"%U\" \"%{Referer}i\" \"%{User-Agent}i\"" testing
>
> 1151335141 default.fantomas.sk default.fantomas.sk - default.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
> 1151335149 default.fantomas.sk 195.168.3.66 - 195.168.3.66 195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
> 1151335157 fantomas.fantomas.sk fantomas.fantomas.sk - fantomas.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 21 5 - "/" "-" "-"
>
> so, with the above configuration, requesting of 195.168.3.66 maps to
> "default.fantomas.sk" virtual host...
>
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
> >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 <uh...@fantomas.sk> 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@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.
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Brian Rectanus <br...@gmail.com>.
On 6/27/06, Matus UHLAR - fantomas <uh...@fantomas.sk> wrote:
> > > <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.
>
> 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.
>
> That is, what docs says and how I understand it.
>
> > 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.
>
> by "the request" I understood the destination IP address and port where the
> request came, independently on the Host: header.
>
> by "host receiving the request" I understood the virtual host (on the given
> IP) whose ServerName or ServerAlias match the provided Host: header. If none
> VirtualHost matches, the first has to be used.
>
> > end of story. Apache doesn't do it and unless you write a patch then I
> > suspect no one else will.
>
> Then, can at least someone help me to write such patch?
>
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.
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.
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. But, I think changing the order
of your conf would be easier.
-B
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
> > <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.
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.
That is, what docs says and how I understand it.
> 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.
by "the request" I understood the destination IP address and port where the
request came, independently on the Host: header.
by "host receiving the request" I understood the virtual host (on the given
IP) whose ServerName or ServerAlias match the provided Host: header. If none
VirtualHost matches, the first has to be used.
> end of story. Apache doesn't do it and unless you write a patch then I
> suspect no one else will.
Then, can at least someone help me to write such patch?
--
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.
Enter any 12-digit prime number to continue.
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Joshua Slive <jo...@slive.ca>.
On 6/27/06, Neil A. Hillard <hi...@whl.co.uk> wrote:
> You are trying to do something that Apache is not designed for. You want:
>
> 195.168.3.66 -> /home/webs/195.168.3.66
> fantomas.fantomas.sk -> /home/webs/fantomas.fantomas.sk
> <everything else> -> /home/webs/default.fantomas.sk
>
> You can't do that. You can do:
>
> fantomas.fantomas.sk -> /home/webs/fantomas.fantomas.sk
> <everything else> -> /home/webs/default.fantomas.sk
>
> 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.
This may be true. But I agree with Matus that this is poorly
documented. I wrote a good chunk of the documentation, and at that
time I was not aware of this particular behavior, so it is not
addressed properly.
Joshua.
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by "Neil A. Hillard" <hi...@whl.co.uk>.
Hi,
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 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 default.fantomas.sk
>> DocumentRoot /home/webs/default.fantomas.sk
>> </VirtualHost>
>
> The problem is, that "default.fantomas.sk" does not exist:
>
> Host default.fantomas.sk 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. nosuchserver.fantomas.sk
> or nosuchserver.apache.org):
>
> 1151413212 default.fantomas.sk nosuchserver.fantomas.sk - nosuchserver.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 20 5 - "/" "-" "-"
> 1151413489 default.fantomas.sk nosuchserver.apache.org - nosuchserver.apache.org 195.168.3.66 fantomas.fantomas.sk 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 "195.168.3.66" should be the std. page I configured.
> The problem currently is, request for 195.168.3.66 falls here :(
>
>> You have made sure you've got a NameVirtualHost 195.168.3.66:80 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 'default.fantomas.sk' is used then the second one is used.
>
> Yes.
>
> But nobody should request "default.fantomas.sk" (except me and other people
> looking at this problem). People may put 195.168.3.66 into their browser and
> get to virtual host for 195.168.3.66 - I make this server for people unable
> to use DNS resolution.
>
> But if anybody points any hostname to 195.168.3.66, it should go to
> "default.fantomas.sk" (actually I can use any other name except
> fantomas.fantomas.sk/195.168.3.66) 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:
195.168.3.66 -> /home/webs/195.168.3.66
fantomas.fantomas.sk -> /home/webs/fantomas.fantomas.sk
<everything else> -> /home/webs/default.fantomas.sk
You can't do that. You can do:
fantomas.fantomas.sk -> /home/webs/fantomas.fantomas.sk
<everything else> -> /home/webs/default.fantomas.sk
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.
--
Neil Hillard hillardn@whl.co.uk
Westland Helicopters Ltd. http://www.whl.co.uk/
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: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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
> > <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>
On 27.06.06 14:20, Pid wrote:
> The "matching IP address" you refer to is NOT in the ServerName
> directive it's in the VirtualHost definition*. The documentation is clear.
I think the cite above means, when a request comes for local IP address, and
there are name virtual hosts on that IP address, apache checks all name
virtual hosts defined on that (aka matching) IP address, if their ServerName
or ServerAlias match the hostmane provided in Host: header.
So, if a request comes to 195.168.3.66, and there is directive
"NameVirtualHost 195.168.3.66", apache will search virtual hosts defined on
195.168.3.66 (using <VirtualHost 195.168.3.66>) for the first, whose
ServerName or ServerAlias match the Host: provided in the request.
If none will match, the first virtual host on 195.168.3.66 will be used.
At least this is how I understand the section above.
--
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.
REALITY.SYS corrupted. Press any key to reboot Universe.
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Pid <p...@pidster.com>.
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 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 default.fantomas.sk
>> DocumentRoot /home/webs/default.fantomas.sk
>> </VirtualHost>
>
> The problem is, that "default.fantomas.sk" does not exist:
>
> Host default.fantomas.sk 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. nosuchserver.fantomas.sk
> or nosuchserver.apache.org):
>
> 1151413212 default.fantomas.sk nosuchserver.fantomas.sk - nosuchserver.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 20 5 - "/" "-" "-"
> 1151413489 default.fantomas.sk nosuchserver.apache.org - nosuchserver.apache.org 195.168.3.66 fantomas.fantomas.sk 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 "195.168.3.66" should be the std. page I configured.
> The problem currently is, request for 195.168.3.66 falls here :(
>
>> You have made sure you've got a NameVirtualHost 195.168.3.66:80 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 'default.fantomas.sk' is used then the second one is used.
>
> Yes.
>
> But nobody should request "default.fantomas.sk" (except me and other people
> looking at this problem). People may put 195.168.3.66 into their browser and
> get to virtual host for 195.168.3.66 - I make this server for people unable
> to use DNS resolution.
>
> But if anybody points any hostname to 195.168.3.66, it should go to
> "default.fantomas.sk" (actually I can use any other name except
> fantomas.fantomas.sk/195.168.3.66) 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>
The "matching IP address" you refer to is NOT in the ServerName
directive it's in the VirtualHost definition*. The documentation is clear.
You are misinterpreting the documentation, and you are just plain WRONG.
*Here:
<VirtualHost MATCHING_IP:PORT>
NOT here:
ServerName FQDN:PORT
> 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.
>
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
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 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 default.fantomas.sk
> DocumentRoot /home/webs/default.fantomas.sk
> </VirtualHost>
The problem is, that "default.fantomas.sk" does not exist:
Host default.fantomas.sk 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. nosuchserver.fantomas.sk
or nosuchserver.apache.org):
1151413212 default.fantomas.sk nosuchserver.fantomas.sk - nosuchserver.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 20 5 - "/" "-" "-"
1151413489 default.fantomas.sk nosuchserver.apache.org - nosuchserver.apache.org 195.168.3.66 fantomas.fantomas.sk 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 "195.168.3.66" should be the std. page I configured.
The problem currently is, request for 195.168.3.66 falls here :(
> You have made sure you've got a NameVirtualHost 195.168.3.66:80 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 'default.fantomas.sk' is used then the second one is used.
Yes.
But nobody should request "default.fantomas.sk" (except me and other people
looking at this problem). People may put 195.168.3.66 into their browser and
get to virtual host for 195.168.3.66 - I make this server for people unable
to use DNS resolution.
But if anybody points any hostname to 195.168.3.66, it should go to
"default.fantomas.sk" (actually I can use any other name except
fantomas.fantomas.sk/195.168.3.66) 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.
--
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.
- Holmes, what kind of school did you study to be a detective?
- Elementary, Watson.
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Pid <p...@pidster.com>.
Neil A. Hillard wrote:
> Hi,
> You have made sure you've got a NameVirtualHost 195.168.3.66:80 set?
>
> 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 'default.fantomas.sk' is used then the second one is used.
>
> This is detailed at:
>
> http://httpd.apache.org/docs/2.0/vhosts/name-based.html
>
> and
>
> http://httpd.apache.org/docs/2.2/vhosts/name-based.html
s'what i've been trying to tell him, but he's convinced it's a bug.
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by "Neil A. Hillard" <hi...@whl.co.uk>.
Hi,
Matus UHLAR - fantomas wrote:
> On 26.06.06 11:54, Joshua Slive wrote:
>>> LogFormat "%{%s}t %v %V %{Host}o %{Host}i %a %h %>s %b %T %u \"%U\"
>>> \"%{Referer}i\" \"%{User-Agent}i\"" testing
>>>
>>> 1151335141 default.fantomas.sk default.fantomas.sk - default.fantomas.sk
>>> 195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
>>> 1151335149 default.fantomas.sk 195.168.3.66 - 195.168.3.66 195.168.3.66
>>> fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
>>> 1151335157 fantomas.fantomas.sk fantomas.fantomas.sk -
>>> fantomas.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 21 5 - "/" "-"
>>> "-"
>>>
>>> so, with the above configuration, requesting of 195.168.3.66 maps to
>>> "default.fantomas.sk" virtual host...
>> Ok. I can partially replicate this on my local server. I don't know
>> exactly what is going on. I'll try to look again later if I have
>> time, but you might want to file a bug report. At minimum, it doesn't
>> seem to match what the documentation says.
>
> Filled up as bug 39910. Thank you very much.
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 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 default.fantomas.sk
DocumentRoot /home/webs/default.fantomas.sk
</VirtualHost>
You have made sure you've got a NameVirtualHost 195.168.3.66:80 set?
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 'default.fantomas.sk' is used then the second one is used.
This is detailed at:
http://httpd.apache.org/docs/2.0/vhosts/name-based.html
and
http://httpd.apache.org/docs/2.2/vhosts/name-based.html
HTH,
Neil.
--
Neil Hillard hillardn@whl.co.uk
Westland Helicopters Ltd. http://www.whl.co.uk/
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: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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 26.06.06 11:54, Joshua Slive wrote:
> >LogFormat "%{%s}t %v %V %{Host}o %{Host}i %a %h %>s %b %T %u \"%U\"
> >\"%{Referer}i\" \"%{User-Agent}i\"" testing
> >
> >1151335141 default.fantomas.sk default.fantomas.sk - default.fantomas.sk
> >195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
> >1151335149 default.fantomas.sk 195.168.3.66 - 195.168.3.66 195.168.3.66
> >fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
> >1151335157 fantomas.fantomas.sk fantomas.fantomas.sk -
> >fantomas.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 21 5 - "/" "-"
> >"-"
> >
> >so, with the above configuration, requesting of 195.168.3.66 maps to
> >"default.fantomas.sk" virtual host...
>
> Ok. I can partially replicate this on my local server. I don't know
> exactly what is going on. I'll try to look again later if I have
> time, but you might want to file a bug report. At minimum, it doesn't
> seem to match what the documentation says.
Filled up as bug 39910. Thank you very much.
--
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.
One OS to rule them all, One OS to find them,
One OS to bring them all and into darkness bind them
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Joshua Slive <jo...@slive.ca>.
On 6/26/06, Matus UHLAR - fantomas <uh...@fantomas.sk> wrote:
>
> I think you've meant %{Host}i, but I added both:
Yes.
>
> LogFormat "%{%s}t %v %V %{Host}o %{Host}i %a %h %>s %b %T %u \"%U\" \"%{Referer}i\" \"%{User-Agent}i\"" testing
>
> 1151335141 default.fantomas.sk default.fantomas.sk - default.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
> 1151335149 default.fantomas.sk 195.168.3.66 - 195.168.3.66 195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
> 1151335157 fantomas.fantomas.sk fantomas.fantomas.sk - fantomas.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 21 5 - "/" "-" "-"
>
> so, with the above configuration, requesting of 195.168.3.66 maps to
> "default.fantomas.sk" virtual host...
Ok. I can partially replicate this on my local server. I don't know
exactly what is going on. I'll try to look again later if I have
time, but you might want to file a bug report. At minimum, it doesn't
seem to match what the documentation says.
Joshua.
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
> On 6/26/06, Matus UHLAR - fantomas <uh...@fantomas.sk> wrote:
> >this is my current configuration of apache (debian: 1.3.33-6sarge1):
> >
> >NameVirtualHost 195.168.3.66:80
> >
> ><VirtualHost 195.168.3.66:80>
> >ServerName default.fantomas.sk
> >DocumentRoot /home/webs/default.fantomas.sk
> ></VirtualHost>
> >
> ><VirtualHost 195.168.3.66:80>
> >ServerName fantomas.fantomas.sk
> >DocumentRoot /home/webs/fantomas.fantomas.sk
> ></VirtualHost>
> >
> ><VirtualHost 195.168.3.66:80>
> >ServerName 195.168.3.66
> >DocumentRoot /home/webs/195.168.3.66
> ></VirtualHost>
> >
> >However, with this configuration I was not able to reach virtual host
> >195.168.3.66. It seems that apache accepts name defined in
> ><VirtualHost [NAME]> as one of hames for name virtual host -
> >when I switched to <VirtualHost fantomas.fantomas.sk>, I couldn't reach
> >virtual host for fantomas.fantomas.sk.
> >
> >I can not simply use <VirtualHost *> because of different virtual servers
> >running at different IP addresses. Also, at other sites I'm configuring
> >apache from databases that contain server-IP pairs, configuring given
> >server
> >at given IP, and exporting this configuration to DNS.
> >
> >Can anyone confirm this behaviour? Can anyone explain to my, why was
> >name-based virtual hosting made this way?
On 26.06.06 09:49, Joshua Slive wrote:
> I'm fairly sure you are incorrect in your interpretation, although
> there is no way I'm going to load up a 1.3 server to test with.
>
> To see what is really going on, add %{Host}o and %v to your LogFormat
> to see what apache is seeing and how it is interpreting it.
I think you've meant %{Host}i, but I added both:
LogFormat "%{%s}t %v %V %{Host}o %{Host}i %a %h %>s %b %T %u \"%U\" \"%{Referer}i\" \"%{User-Agent}i\"" testing
1151335141 default.fantomas.sk default.fantomas.sk - default.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
1151335149 default.fantomas.sk 195.168.3.66 - 195.168.3.66 195.168.3.66 fantomas.fantomas.sk 200 20 4 - "/" "-" "-"
1151335157 fantomas.fantomas.sk fantomas.fantomas.sk - fantomas.fantomas.sk 195.168.3.66 fantomas.fantomas.sk 200 21 5 - "/" "-" "-"
so, with the above configuration, requesting of 195.168.3.66 maps to
"default.fantomas.sk" virtual host...
--
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.
If Barbie is so popular, why do you have to buy her friends?
---------------------------------------------------------------------
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
Re: [users@httpd] (again) Can not define "default" name virtual host
Posted by Joshua Slive <jo...@slive.ca>.
On 6/26/06, Matus UHLAR - fantomas <uh...@fantomas.sk> wrote:
> Hello,
>
> this is my current configuration of apache (debian: 1.3.33-6sarge1):
>
> NameVirtualHost 195.168.3.66:80
>
> <VirtualHost 195.168.3.66:80>
> ServerName default.fantomas.sk
> DocumentRoot /home/webs/default.fantomas.sk
> </VirtualHost>
>
> <VirtualHost 195.168.3.66:80>
> ServerName fantomas.fantomas.sk
> DocumentRoot /home/webs/fantomas.fantomas.sk
> </VirtualHost>
>
> <VirtualHost 195.168.3.66:80>
> ServerName 195.168.3.66
> DocumentRoot /home/webs/195.168.3.66
> </VirtualHost>
>
> However, with this configuration I was not able to reach virtual host
> 195.168.3.66. It seems that apache accepts name defined in
> <VirtualHost [NAME]> as one of hames for name virtual host -
> when I switched to <VirtualHost fantomas.fantomas.sk>, I couldn't reach
> virtual host for fantomas.fantomas.sk.
>
> I can not simply use <VirtualHost *> because of different virtual servers
> running at different IP addresses. Also, at other sites I'm configuring
> apache from databases that contain server-IP pairs, configuring given server
> at given IP, and exporting this configuration to DNS.
>
> Can anyone confirm this behaviour? Can anyone explain to my, why was
> name-based virtual hosting made this way?
I'm fairly sure you are incorrect in your interpretation, although
there is no way I'm going to load up a 1.3 server to test with.
To see what is really going on, add %{Host}o and %v to your LogFormat
to see what apache is seeing and how it is interpreting it.
Joshua.
---------------------------------------------------------------------
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