[mod_python] Connection Handler in a virtual host

Kamil Niechajewicz kamil at nvstudio.pl
Mon Mar 1 18:13:56 EST 2004


On Mon, 1 Mar 2004 16:31:46 +0200 (EET)
Miikka Miettinen <mmmietti at cs.helsinki.fi> wrote:

> If I try this (supplemented with "NameVirtualHost site1.xyz.org:80" and 
> "NameVirtualHost site2.xyz.org:80"), I get the warning "NameVirtualHost 
> site2.xyz.org:80 has no VirtualHosts". Again, both sites work and have 
> different document roots, but the connection handler still isn't called.
> 
> If I understood the Apache documentation correctly, you normally use the 
> server's IP address in the NameVirtualHost directive. I only have one IP 
> address, so maybe I get the warning because both virtual hosts somehow 
> look the same. But the document roots are different. Confusing.

I will give you example for my site, for example somewhere I have IP 
1.2.3.4 which serves two virtual hosts xyz.org and abc.com

You need only one NameVirtualHost because you just want to tell Apache
what IPs serve virtual hosts. When your hosts have IN A for the same IP 
just put it in NameVirtualHost, and then define those hosts in VirtualHost
directive.

NameVirtualHost 1.2.3.4

<VirtualHost xyz.org:80>
   ...
</VirtualHost>

<VirtualHost abc.com:80>
  ...
</VirtualHost>

<VirtualHost 1.2.3.4:80>
   # this will be applied when user views http://1.2.3.4 instead
   # of http://abc.com or http://xyz.org
</VirtualHost>

and it works without problem and always worked.

/K


More information about the Mod_python mailing list