You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Mat <ma...@hotmail.com> on 2001/10/09 11:38:10 UTC

Both global hanlder and cgi scripts

Hi everybody,

   actually i'm working on a website where I want to have the following 
possibilities :
       - a global handler that will treat a request hitting 
http://myhost.com/
       - the ability to have execution of separate cgi scripts like 
http://myhost.com/script.cgi

   I have the following configuration in httpd.conf :
(the AddHandler cgi-script .cgi is set)

<VirtualHost _default_:80>
       ServerAdmin     webmaster@myhost.com
       ServerName      www.myhost.com
       DocumentRoot    /home/webmaster/www/myhost.com

       ErrorLog        /usr/local/apache/logs/error.log
       CustomLog       /usr/local/apache/logs/access.log common

       ## mod_perl stuff
       PerlTaintCheck          Off
       PerlFreshRestart        On
       PerlRequire             /home/webmaster/scripts/startup.pl

       ## allow cgi's here and there
       <Files *.cgi>
               PerlSendHeader Off
               PerlHandler Apache::Registry
               SetHandler perl-script
               Options +ExecCGI
       </Files>


       ## handler stuff for the index
       <Location "/">
               SetHandler      perl-script
               PerlHandler     TOL::Index
       </Location>

</VirtualHost>

so when the "/" is hit my module takes over and display the page 
perfectly. But when  I try to call the cgi scripts, it displays my code 
and doesn't execute it.

I searched the archive for this problem and found the following post 
http://groups.yahoo.com/group/modperl/message/33720 which talks about 
using FilesMatch, I tried but it didn't work.

I'd like not to use a specific directory to put my scripts in (with 
Alias or Script Alias directives) and like to know if there is a simple 
of doing what i want.

Thanks.

   Mat

ps: i'm using apache 1.3.20, mod_perl 1.26, perl 5.6.1, no messages in 
error logs.


Re: Both global hanlder and cgi scripts

Posted by Nate Campi <na...@campin.net>.
On Tue, Oct 09, 2001 at 11:38:10AM +0200, Mat wrote:
> Hi everybody,
> 
>    actually i'm working on a website where I want to have the following 
> possibilities :
>        - a global handler that will treat a request hitting 
> http://myhost.com/
>        - the ability to have execution of separate cgi scripts like 
> http://myhost.com/script.cgi

I had some trouble with this, and found a workable solution, for the
"Navbar" handler from the eagle book:

  <Files ~ "\.htm*">
          SetHandler  perl-script
          PerlHandler Apache::NavBar
          PerlSetVar NavConf /etc/apache/perl/navigation.conf
  	
  </Files>

Substitute the <Files> directive for the <Location "/"> and this should
work. This works against .html and .htm files That's all I had for 
content on that server so it works great for me.
-- 
Nate Campi		<na...@campin.net>
GnuPG key: 0xC17AEF79	http://www.campin.net