You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Steven Vetzal <st...@dabax.com> on 2001/04/22 05:15:32 UTC
Perl Config for VirtualHosts
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);
$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",
};
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" },
] );
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
Re: Perl Config for VirtualHosts
Posted by Nikolaus Rath <Ni...@rath.org>.
* Steven Vetzal <st...@dabax.com> wrote:
> Location => [ "/ext" => { SetHandler => "default-handler" } ],
^ ^
Shouldn't this be { .. }?
> ------_=_NextPart_001_01C0CADA.7F31E412
> Content-Type: text/html;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
brrr....
- Nikolaus
--
"de.alt.comp.kde Dumm und trotzdem UNIX verwenden? KDE ist die Loesung."
Sven Paulus in <67...@imperator.oops.sub.de>