You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Paonia Ezrine <pa...@home.welcomehome.org> on 2000/10/31 21:31:09 UTC

mod_perl on specific scripts

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)?

Thanks,
Paonia


Re: mod_perl on specific scripts

Posted by "Christopher L. Everett" <ce...@ceverett.com>.
David Hodgkinson wrote:
> 
> Paonia Ezrine <pa...@home.welcomehome.org> 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
ceverett@ceverett.com

Re: mod_perl on specific scripts

Posted by David Hodgkinson <da...@hodgkinson.org>.
Matthew Byng-Maddick <mb...@colondot.net> writes:

> On 1 Nov 2000, David Hodgkinson wrote:
> > Matthew Byng-Maddick <mb...@colondot.net> writes:
> > > On 31 Oct 2000, David Hodgkinson wrote:
> > > > Did I just condemn you to learning mod_rewrite? Ooops :-)
> > > You do, of course, know about all the latest patches for this, due to
> > > potential security problems....
> > ...moving to Apache 1.3.14, right?
> 
> Some are fixed in 1.3.14 but there are an extra set of patches for 1.3.14
> to fix the things that weren't fixed.

And where do these hide? I can't see them on apache.org in either
patches directory...

Cheers,

Dave

-- 
Dave Hodgkinson,                             http://www.hodgkinson.org
Editor-in-chief, The Highway Star           http://www.deep-purple.com
      Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -----------------------------------------------------------------

Re: mod_perl on specific scripts

Posted by Matthew Byng-Maddick <mb...@colondot.net>.
On 1 Nov 2000, David Hodgkinson wrote:
> Matthew Byng-Maddick <mb...@colondot.net> writes:
> > On 31 Oct 2000, David Hodgkinson wrote:
> > > Did I just condemn you to learning mod_rewrite? Ooops :-)
> > You do, of course, know about all the latest patches for this, due to
> > potential security problems....
> ...moving to Apache 1.3.14, right?

Some are fixed in 1.3.14 but there are an extra set of patches for 1.3.14
to fix the things that weren't fixed.

MBM

-- 
Matthew Byng-Maddick   Home: <mb...@colondot.net>  +44 20  8981 8633  (Home)
http://colondot.net/   Work: <ma...@codix.net> +44 7956 613942  (Mobile)
To err is human, to forgive is against company policy.


Re: mod_perl on specific scripts

Posted by David Hodgkinson <da...@hodgkinson.org>.
Matthew Byng-Maddick <mb...@colondot.net> writes:

> On 31 Oct 2000, David Hodgkinson wrote:
> > Did I just condemn you to learning mod_rewrite? Ooops :-)
> 
> You do, of course, know about all the latest patches for this, due to
> potential security problems....

...moving to Apache 1.3.14, right?

-- 
Dave Hodgkinson,                             http://www.hodgkinson.org
Editor-in-chief, The Highway Star           http://www.deep-purple.com
      Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -----------------------------------------------------------------

Re: mod_perl on specific scripts

Posted by Matthew Byng-Maddick <mb...@colondot.net>.
On 31 Oct 2000, David Hodgkinson wrote:
> Did I just condemn you to learning mod_rewrite? Ooops :-)

You do, of course, know about all the latest patches for this, due to
potential security problems....

MBM

-- 
Matthew Byng-Maddick   Home: <mb...@colondot.net>  +44 20  8981 8633  (Home)
http://colondot.net/   Work: <ma...@codix.net> +44 7956 613942  (Mobile)
To err is human, to forgive is against company policy.


Re: mod_perl on specific scripts

Posted by David Hodgkinson <da...@hodgkinson.org>.
Paonia Ezrine <pa...@home.welcomehome.org> 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 :-)

Plan B would be to maybe do it by suffix? Can you do that?

-- 
Dave Hodgkinson,                             http://www.hodgkinson.org
Editor-in-chief, The Highway Star           http://www.deep-purple.com
      Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -----------------------------------------------------------------

Re: mod_perl on specific scripts

Posted by Bill Moseley <mo...@hank.org>.
At 08:00 PM 10/31/00 -0500, Paonia Ezrine wrote:
>Bill,
>this is good in thoery but I have not gotten it to work in practice.
>
>here is the general idea (of what I tried):
><Files /home/httpd/cgi-bin/test2.pl>

<Files test2.pl>

And you can use it within a <Directory> to limit its reach.

http://httpd.apache.org/docs/mod/core.html#files



Bill Moseley
mailto:moseley@hank.org

Re: mod_perl on specific scripts

Posted by Bill Moseley <mo...@hank.org>.
At 03:31 PM 10/31/00 -0500, Paonia Ezrine wrote:
>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)?

How about the <files> directive.


Bill Moseley
mailto:moseley@hank.org