[mod_python] Dynamic virtualhost configuration

VanL vlindberg at verio.net
Fri Mar 21 18:01:10 EST 2003


In a book about apache, I came across the following bit of code for 

[embedded in httpd.conf]
# generate virtual hosts on the fly with Perl
#!/usr/bin perl -w

[snip some stuff]

# Open the virtual hosts file
open (FILE, "/usr/local/apache/conf/vhosts.conf");

     # Create a virtual host based on this line
     ($ip,$host,$admin,$vroot,$aliases) = split /\s*,\s*, $_;
     $VirtualHost {$ip} = {

         [Create virtual host from variables]

[snip other stuff]

[continue httpd.conf]

Is it possible to do the same with mod_python?  I am in a situation 
where I have many subhosts, substantially similar.  Being able to define 
a shorthand for virtual hosts would be a big plus.

In a similar vein, the documentation talks about dynamically associating 
different handlers with a request.  Are these python handlers only, or 
could mod_python do a runtime check that associates mod_php with .php 
files in a specific virtualhost?



More information about the Mod_python mailing list