You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Developer <de...@pas-world.com> on 2009/04/05 16:58:31 UTC

[users@httpd] About: NameVirtualHost ... has no VirtualHosts

Hello,
I have config file like this:

...
>         Listen [fec0::40]:80
>         NameVirtualHost myhost.com:80.
>         <VirtualHost myhost.com:80 >
>                 ServerName  myhost.com.
> ...
> </VirtualHost>


All work fine, but I get error message like:
> NameVirtualHost myhost.com has no VirtualHosts
on start. myhost.com is name based host accesible and works.

I can not see the problem for this. Any suggestion?





-- 














--
--
Publicidad y Servicios http://www.pas-world.com
Tienda http://informatica.precioventa.com



---------------------------------------------------------------------
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] About: NameVirtualHost ... has no VirtualHosts

Posted by André Warnier <aw...@ice-sa.com>.
Developer wrote:
> El dom, 05-04-2009 a las 09:18 -0700, J. Greenlees escribió:
>> if you have NameVirtualHost *:80 the error goes away
> 
> 
> Now ,like before changes, all virtual host works fine but without  httpd
> warnings:
> 
> Listen [fce0::40]:80
> ...
> NameVirtualHost *:80
> ...
> <VirtualHost *:80 >
> ServerName  foo1.com
> ...
> </VitualHost>
> ...
> <VirtualHost *:80 >
> ServerName  foo2.com
> ...
> </VitualHost>
> 
If I may ask, why are you doing this :
 > Listen [fce0::40]:80

instead of just :

  Listen *:80

?

Does that server have multiple IP addresses, and you want Apache to 
listen on just one of 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] About: NameVirtualHost ... has no VirtualHosts

Posted by Developer <de...@pas-world.com>.
El dom, 05-04-2009 a las 09:18 -0700, J. Greenlees escribió:
> if you have NameVirtualHost *:80 the error goes away


Now ,like before changes, all virtual host works fine but without  httpd
warnings:

Listen [fce0::40]:80
...
NameVirtualHost *:80
...
<VirtualHost *:80 >
ServerName  foo1.com
...
</VitualHost>
...
<VirtualHost *:80 >
ServerName  foo2.com
...
</VitualHost>


Thanks,



---------------------------------------------------------------------
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] About: NameVirtualHost ... has no VirtualHosts

Posted by Eric Covener <co...@gmail.com>.
On Sun, Apr 5, 2009 at 12:18 PM, J. Greenlees <li...@jaqui-greenlees.net> wrote:
> I have found that NameVirtualHost foo.com:80 causes this error message.
> if you have NameVirtualHost *:80 the error goes away.
> Then specify the host name in the vhost container as has been done.

NVH doesn't do anything except when its arguments exactly match (not
logically via wildcards or missing ports) a set of VirtualHost
containers.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] About: NameVirtualHost ... has no VirtualHosts

Posted by "J. Greenlees" <li...@jaqui-greenlees.net>.
Krist van Besien wrote:
> On Sun, Apr 5, 2009 at 6:18 PM, J. Greenlees <li...@jaqui-greenlees.net> wrote:
>
>
>   
>> I tried specifying the name in the NameVirtualHost for 3 domains.
>> [ one entry per domain, naturally. ] It was only by using the *.:80 in
>> the NameVirtualHost directive, and only having the one NameVirtualHost
>> for multiple vhosts that the error went away.
>>     
>
> You could have found this out by reading the manual too :-)
>   

But then I wouldn't remember it as well. ;-)
I always try to figure it out without touching the docs, and usually
succeed, so I remember it better.
I may not know why it was done that way until I read them, but I do at
least remember how to use the directives correctly.

~snip~
> Putting the servhostname in the <VirtualHost> tag itself does not
> cause apache to match requests to this hostname to this block, as in
> the value inside the <VirtualHost> tag is only used to match against a
> NameVirtualHost statement...
>
> Krist
True, it just makes it easier for a human to scan a listing of them and
find the one they want.
The layout of the Virtualhost container makes finding the container
delimiters easer than finding the servername directive when scanning
through a number of them.

Jaqui



---------------------------------------------------------------------
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] About: NameVirtualHost ... has no VirtualHosts

Posted by Krist van Besien <kr...@gmail.com>.
On Sun, Apr 5, 2009 at 6:18 PM, J. Greenlees <li...@jaqui-greenlees.net> wrote:


> I tried specifying the name in the NameVirtualHost for 3 domains.
> [ one entry per domain, naturally. ] It was only by using the *.:80 in
> the NameVirtualHost directive, and only having the one NameVirtualHost
> for multiple vhosts that the error went away.

You could have found this out by reading the manual too :-)

It is _by design_ that name based virtual hosts works this way.
The "NameVirtualHost" directive tells the apache daemon on what IP
address/port combination it should handle requests for multiple, named
based virtual hosts. The most usual way this is used is by specifying

NameVirtualHost *:80.

You do not normally use names here, unless you have several IP
adresses associated with your machine, and want to distinguish between
them using a name, and not an IP.
When a request arrives on a IP/port combination mentioned in a
NameVirtualHost directive the server will next look at <VirtualHost>
blocks that match the NameVirtualHost directive. And the first block
where the "Servname" directive matches the "host" header in the HTTP
request will be used. If none match the first <VirtualHost> will be
used.
You normally would have <VirtualHost> blocks that look like this:

<VirtualHost *:80>
Servername foo.com

</VirtualHost>

Putting the servhostname in the <VirtualHost> tag itself does not
cause apache to match requests to this hostname to this block, as in
the value inside the <VirtualHost> tag is only used to match against a
NameVirtualHost statement...

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
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] About: NameVirtualHost ... has no VirtualHosts

Posted by "J. Greenlees" <li...@jaqui-greenlees.net>.
Eric Covener wrote:
> On Sun, Apr 5, 2009 at 10:58 AM, Developer <de...@pas-world.com> wrote:
>   
>> Hello,
>> I have config file like this:
>>
>> ...
>>     
>>>         Listen [fec0::40]:80
>>>         NameVirtualHost myhost.com:80.
>>>         <VirtualHost myhost.com:80 >
>>>                 ServerName  myhost.com.
>>> ...
>>> </VirtualHost>
>>>       
>
> httpd/apachectl/apache2ctl -S would probably show you that either NVH
> and VH don't match exactly, or you have duplicate NVH'es.
>
>   
I have found that NameVirtualHost foo.com:80 causes this error message.
if you have NameVirtualHost *:80 the error goes away.
Then specify the host name in the vhost container as has been done.


I tried specifying the name in the NameVirtualHost for 3 domains.
[ one entry per domain, naturally. ] It was only by using the *.:80 in
the NameVirtualHost directive, and only having the one NameVirtualHost
for multiple vhosts that the error went away.

Jaqui



---------------------------------------------------------------------
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] About: NameVirtualHost ... has no VirtualHosts

Posted by Eric Covener <co...@gmail.com>.
On Sun, Apr 5, 2009 at 10:58 AM, Developer <de...@pas-world.com> wrote:
> Hello,
> I have config file like this:
>
> ...
>>         Listen [fec0::40]:80
>>         NameVirtualHost myhost.com:80.
>>         <VirtualHost myhost.com:80 >
>>                 ServerName  myhost.com.
>> ...
>> </VirtualHost>

httpd/apachectl/apache2ctl -S would probably show you that either NVH
and VH don't match exactly, or you have duplicate NVH'es.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] About: NameVirtualHost ... has no VirtualHosts

Posted by André Warnier <aw...@ice-sa.com>.
Developer wrote:
> Hello,
> I have config file like this:
> 
> ...
>>         Listen [fec0::40]:80
>>         NameVirtualHost myhost.com:80.
>>         <VirtualHost myhost.com:80 >
>>                 ServerName  myhost.com.
>> ...
>> </VirtualHost>
> 
> 
> All work fine, but I get error message like:
>> NameVirtualHost myhost.com has no VirtualHosts
> on start. myhost.com is name based host accesible and works.
> 
> I can not see the problem for this. Any suggestion?
> 
Hi.
I do not really understand the syntax you are using above, but the 
reason why it works may be as follows :

- the Listen instruction will cause Apache to listen for connections and 
requests on port 80, on the IP address you have specified (which is the 
bit that I do not really understand, since I know little about IPv6)
- the NameVirtualHost tells Apache that you want to define Virtual 
Hosts, but somehow that line and the <VirtualHost> line do not match, so 
Apache warns you.
- no matter what, Apache will have a "default host", that will handle 
all the requests which one way or another arrive on that (physical) 
host.  That is what makes you think that it works.

To see if the above is the case :
- in your local "hosts" file (Unix/Linux: /etc/hosts, Windows: 
/windows/system32/drivers/etc/hosts), add a line with the IP address of 
your host, and some funny name like "abc.xyz.com"
- in your browser (on the same system where you modified the hosts 
file), try http://abc.xyz.com
If it also works, then the explanation above is correct.


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