David Hodgkinson wrote:
>
> Paonia Ezrine <[EMAIL PROTECTED]> writes:
>
> > I have a number of scripts in places other then /perl that I want to use
> > mod_perl for. However, I can't turn it on for all scripts in a specific
> > directory or even a certain extension. Is there any way to do this or am
> > I going to need to do a redirect of some sort (anyone have one)?
>
> I trust you've set up a thin apache at the front? Then it's easy to
> pass only the scripts you want back to the mod_perl server.
>
> Did I just condemn you to learning mod_rewrite? Ooops :-)
Assuming your script is written as a mod_perl handler, and assuming
the aforesaid thin Apache in front, try mod_proxy on the front end
and Location on the back end. What I do in my httpd-static.conf
(cribbed wholesale from the Guide, names changed to protect the
innocent):
<VirtualHost www.xxx.yyy.zzz:ppp>
ServerName www.foo.com
ProxyRequests on
ProxyPass /cgi-bin/ http://localhost:8080/bar/baz/
ProxyPassReverse /cgi-bin/ http://localhost:8080/bar/baz/
RewriteRule ^proxy:.* - [F] # keep others from using your proxy
ProxyReceiveBufferSize 65536 # buffer more data thru the proxy
# put whatever else you need in here too, like SSL configs, root dirs,
# and whatnot
</VirtualHost>
and in the httpd-perl.conf:
<Location /boo/baz/noot.cgi>
SetHandler perl-script
PerlHandler Knights::who::say::Nit
# likely more stuff goes in here too, see the Guide for details
</Location>
If your scripts are of type Apache::Registry, instead do
Alias /bar/baz/ /your/special/path/to/your/scripts/
<Location /bar/baz/>
SetHandler perl-script
PerlHandler +Apache::Registry
Options ExecCGI
PerlSendHeader On
</Location>
<META>
Would something like
Alias /bar/baz/foo.cgi /your/special/path/to/foo.cgi
work? Because then this will work:
<Location /bar/baz/foo.cgi>
SetHandler perl-script
PerlHandler +Apache::Registry
Options ExecCGI
PerlSendHeader On
</Location>
and we can mix PerlHandlers and Apache::Registry scripts in
the same (virtual) direactory. That would be a win.
</META>
At least this handles the directory problem. The file extension
problem really does require mod_rewrite, I believe.
The beauty of this is that what the client sees really has nothing
to do with where the scripts are on your server. On my box, I used
mod_proxy to virtualize the /cgi-bin/ directory. When a request
comes in for http://www.foo.com/cgi-bin/noot.cgi, the request gets
passed back, the proper PerlHandler gets called, and life goes on.
I admit that I've deliberately avoided learning mod_rewrite; I took
one look at it and said "I'm doing something else!". So I set up
all my sites to avoid using it. God help me if I ever really _have_
to use it, though :)
--Christopher
Christopher L. Everett
[EMAIL PROTECTED]