You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Chris Faust <cf...@doyougot.com> on 2004/01/10 19:45:47 UTC

Run script for directory index

Hey All,

I'm trying to have my MP2 script that displays HTML run when someone hits the docroot (http://www.mydomain.com)..
It may be considered somewhat off-topic, but when using standard CGI I didn't have any problems doing this by just having:

"DirectoryIndex /cgi-bin/index.cgi"

But I can't seem to accomplish the same thing using MP2 while still being able to define other dirs (like a image dir)..

Here is a trimmed example of my conf file, If I change the <Location /index> to just <Location />, I'll get the results I want when hitting the docroot, but then anything else defined (like the images), just invokes my MP2 handler.

Can someone tell me what I'm missing here?
Running MP2, Apache 2 on RH9

Thanks
-Chris

<VirtualHost xxx.xxx.xxx.xxx:80>
        ServerName domain.info
        DocumentRoot /websites/domain/site_root
        ServerAdmin webmaster@domain.info
        ServerAlias domain.com
        ServerAlias xxx.xxx.xxx.xxx:80
        ErrorLog /websites/domain/logs/error.log
        CustomLog /websites/domain/logs/access.log combined
PerlModule INDEX::Index
<Location "/index">
        SetHandler perl-script
        PerlHandler INDEX::Index
 DirectoryIndex /index
</Location>
Alias /images "/websites/domain/site_root/html/images/"
<Directory "/websites/domain/html/images">
        Order allow,deny
        Allow from all
</Directory>
</VirtualHost>

Re: Run script for directory index

Posted by Chris Faust <cf...@doyougot.com>.
>
> try changing
> >         SetHandler perl-script
> to
>           AddHandler perl-script
>
> I had a similar problem and my understanding is that AddHandler won't
clobber
> any existing default handlers for things like images so that they will get
> handled correctly.
>
> Michael Peters
> Venzia
>

Hi Michael,

I gave it a shot, unfortunately I got the same results.
I'm starting to run out of things to try!!

Thanks
-Chris



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Run script for directory index

Posted by petersm <pe...@venzia.com>.


"Chris Faust" <cf...@doyougot.com> wrote 
> But I can't seem to accomplish the same thing using MP2 while still being
able to define other dirs (like a image dir)..

try changing 
>         SetHandler perl-script
to
          AddHandler perl-script

I had a similar problem and my understanding is that AddHandler won't clobber
any existing default handlers for things like images so that they will get
handled correctly.

Michael Peters
Venzia


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Run script for directory index

Posted by Chris Faust <cf...@doyougot.com>.
> Stas Bekman wrote:
> I think you simply miss:
>     SetHandler default-handler
> when overriding / in the /images container.
>
> If it still doesn't work, I'd suspect a bug in merging rules. What happens
if
> you use either two Location containers or two Directory containers and not
> mixing them?
>


Doh!!! Thanks Stas, the "default-handler" was exactly it..
I did try on mixing and matching the 2 container types before with the same
results, but now with the "default-handler" added they both work properly.

Thanks Again!
-Chris



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Run script for directory index

Posted by Stas Bekman <st...@stason.org>.
Chris Faust wrote:
> Hey All,
> 
> I'm trying to have my MP2 script that displays HTML run when someone hits
> the docroot (http://www.mydomain.com).. It may be considered somewhat
> off-topic, but when using standard CGI I didn't have any problems doing
> this by just having:
> 
> "DirectoryIndex /cgi-bin/index.cgi"
> 
> But I can't seem to accomplish the same thing using MP2 while still being
> able to define other dirs (like a image dir)..
> 
> Here is a trimmed example of my conf file, If I change the <Location
> /index> to just <Location />, I'll get the results I want when hitting the
> docroot, but then anything else defined (like the images), just invokes my
> MP2 handler.
> 
> Can someone tell me what I'm missing here? Running MP2, Apache 2 on RH9
 >
 > <Location "/index">
 >         SetHandler perl-script
 >         PerlHandler INDEX::Index
 >  DirectoryIndex /index
 > </Location>
 > Alias /images "/websites/domain/site_root/html/images/"
 > <Directory "/websites/domain/html/images">
 >         Order allow,deny
 >         Allow from all
 > </Directory>


I think you simply miss:
    SetHandler default-handler
when overriding / in the /images container.

If it still doesn't work, I'd suspect a bug in merging rules. What happens if
you use either two Location containers or two Directory containers and not
mixing them?

<Location "/">
         SetHandler perl-script
         PerlHandler INDEX::Index
</Location>
Alias /images "/websites/domain/site_root/html/images/"
<Location "/images">
         SetHandler default-handler
         Order allow,deny
         Allow from all
</Directory>

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html