Hi
Folks,
I've been
grappling with this for a while, and was wondering if anyone could help me
out...
I'm trying
to set up a series of VirtualHost sections in httpd.conf using Perl. I want to
set the PerlHandler for the VirtualHost to "perl-script", but I want to define
several Location sections with the PerlHandler set to
"default-handler".
I'm using a
structure like this to define the VirtualHost sections (the $xp is an XPath
object using Matt Sergeant's XML::XPath module):
$region =
$xp->findvalue("./\@region",
$instance);
$address = $xp->findvalue("./address", $instance);
$sitename = $xp->findvalue("./name", $instance);
$admin = $xp->findvalue("./admin", $instance);
$ext = $xp->findvalue("./ext", $instance);
$address = $xp->findvalue("./address", $instance);
$sitename = $xp->findvalue("./name", $instance);
$admin = $xp->findvalue("./admin", $instance);
$ext = $xp->findvalue("./ext", $instance);
$VirtualHost{"$sitename:8080"} =
{
ServerAdmin => "$admin",
DocumentRoot => "/home/httpd/web/$appname/web/pub",
ServerName => "$sitename",
ErrorLog => "/home/httpd/var/logs/apache/$appname.error_log",
TransferLog => "/home/httpd/var/logs/apache/$appname.transfer_log",
PerlSetVar => "Region $region",
SetHandler => "perl-script",
PerlHandler => "HTML::Mason",
};
ServerAdmin => "$admin",
DocumentRoot => "/home/httpd/web/$appname/web/pub",
ServerName => "$sitename",
ErrorLog => "/home/httpd/var/logs/apache/$appname.error_log",
TransferLog => "/home/httpd/var/logs/apache/$appname.transfer_log",
PerlSetVar => "Region $region",
SetHandler => "perl-script",
PerlHandler => "HTML::Mason",
};
Now this
works great - everything is cool. However if I add the following to the
$VirtualHost{} assignment:
Location => [ "/ext" => {
SetHandler => "default-handler" } ],
Or if I try
to set up an assignment outside that structure with:
$VirtualHost{"$sitename:8080"}->{Location} = ( [ "/ext" => {
SetHandler=> "default-handler"
},
"/images" => { SetHandler => "default-handler" },
] );
"/images" => { SetHandler => "default-handler" },
] );
I get an error
like:
[Sat Apr 21
23:06:30 2001] [error] (22)Invalid argument: <Perl>: Invalid command
'Location', perhaps mis-spelled or defined by a module not included in the
server configuration
I'm really not
sure about my structure syntax - I've got an Alias directive I managed to get
working, and modelled the Location stuff after it, but I just can't get this
sucker to go. I'm finding the mod_perl guide a little vague, talking only
about Location as a discreet variable (which I assume is server global?),
and I'm just not getting how to do this within the scope of a
VirtualHost...
Steve