perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Prime <>
Subject Re: Running a mod_perl script at the domain root
Date Sun, 10 Feb 2008 21:47:04 GMT
There are a couple of ways you can tackle this sort of thing.

1) You can modify TestSite to return DECLINED for any request that you 
want to be handled by the filesystem rather than your handler.  ie

if $r->uri =~ m|\css$| {
     return Apache2::Const::DECLINED;

2) If you've got all your CSS and images in directories dedicated to 
those tasks, then you can add locations blocks that SetHandler 
default-handler.  ie:

<Location />
     SetHandler perl-script
     PerlResponseHandler TestSite

<Location /images>
     SetHandler default-handler

<Location /css>
     SetHandler default-handler

There are likely other ways to handle it too.


Matthew Tylee Atkinson wrote:
> I've spent at least a couple of hours trying to figure this out and
> reading manuals, to no avail, hence asking here.  I hope it's not too
> obvious :-).
> I'm running a mod_perl (2.0.2) script from the root of my domain.  My
> Apache (2.2.3) configuration is as follows.
> <VirtualHost *>
>     . . .
>     PerlOptions +Parent
>     PerlSwitches -T -I/var/www/testsite
>     <Location />
>         SetHandler perl-script
> 	PerlResponseHandler TestSite
>     </Location>
> </VirtualHost>
> My script takes the whole URI and uses that as part of the input to tell
> it which part of the site the user wants to visit (such as / for the
> home page or /account to manage their contact details).
> The problem is that, because the script overrides the whole domain, a
> request for /logo.png or the CSS file will not work properly.
> I have tried using mod_rewrite to combat this, to no avail.  I think the
> problem is that when I was using mod_python on a different site (a
> MoinMoin wiki as it happens), the handling of the request is different;
> it'd be more like the following:
>     # map /wiki static files to Moin htdocs
>     RewriteRule ^/wiki/(.*)$ /var/www/agdev-wiki/htdocs/$1 [last]
>     # map everything else to server script
>     RewriteRule ^(.*)$ /var/www/agdev-wiki/$1
> In this case, I can successfully use mod_rewrite because I can send the
> request to a certain script.  I can't see how to send the request to a
> certain location, as would appear to be required by the mod_perl setup.
> Could someone direct me to instructions or an example Apache config
> where they're running a mod_perl script at the domain root?
> Thanks very much for your time,
> best regards,
> P.S. My site is now running much faster under mod_perl (albeit without
> CSS or a logo at the moment :-)) -- mod_perl really does seem to rock
> maximally and I'm looking forward to getting it all working smoothly.

View raw message