[mod_python] Connection Handler in a virtual host

Kamil Niechajewicz kamil at nvstudio.pl
Mon Mar 1 15:28:55 EST 2004


On Mon, 1 Mar 2004 10:22:13 +0200 (EET)
Miikka Miettinen <mmmietti at cs.Helsinki.FI> wrote:

> <VirtualHost *:80>
>     #this is an "ordinary web site"
>     ServerName site1.xyz.org:80
>     DocumentRoot /var/www/site1/htdocs
>     #...
> </VirtualHost>
> 
> <VirtualHost *:80>
>     ServerName site2.xyz.org:80
>     DocumentRoot /var/www/site2/htdocs
>     PythonPath "sys.path+['/var/www/test']"
>     PythonConnectionHandler conntest
> </VirtualHost>

Why are you doing VirtualHost *:80 two times? Shouldn't it be:

<VirtualHost site1.xyz.org:80>
     ServerName site1.xyz.org:80
     DocumentRoot /var/www/site1/htdocs
</VirtualHost>

<VirtualHost site2.xyz.org:80>
     ServerName site2.xyz.org:80
     DocumentRoot /var/www/site2/htdocs
     PythonPath "sys.path+['/var/www/test']"
     PythonConnectionHandler conntest
 </VirtualHost>

Changing ports worked probably because those two declarations
were different. When you have *:80 and *:80 the first (or last, I 
don't remember) was applied to every possible host, I guess. You 
need to specify hostname in VirtualHost directive..

/K


More information about the Mod_python mailing list