httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krist van Besien <krist.vanbes...@gmail.com>
Subject Re: [users@httpd] About: NameVirtualHost ... has no VirtualHosts
Date Mon, 06 Apr 2009 06:53:38 GMT
On Sun, Apr 5, 2009 at 6:18 PM, J. Greenlees <lists@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


Mime
View raw message