You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Hemond, Steve" <SH...@SMURFIT.com> on 2004/02/04 15:05:56 UTC

Handlers/locations

Hi ppl,

I have setup Apache2/mod_perl and started writing perl scripts to
generate html code.

I have a /wood/ directory with two subdirs : /perl/ and /images/

Actually I have setup httpd.conf this way :

<Directory /prog/www/wood/perl>
    SetHandler perl-script
    PerlResponseHandler ModPerl::Registry
    PerlOptions +ParseHeaders
    Options +ExecCGI
</Directory>

In my perl file I have this line :
<link type="text/css" rel="stylesheet" href="../menu.css"></link>

And this line:
<img src="../images/banner.jpg"></img>

The problem is it don't go at the right place to find my image and
stylesheet. [Tue Feb 03 15:08:58 2004] [error] 51806: ModPerl::Registry:
/prog/www/wood/perl/menu.css not found or unable to stat [Tue Feb 03
15:08:58 2004] [error] 41882: ModPerl::Registry:
/prog/www/wood/perl/images not found or unable to stat

If I put the perl files in the root directory (/wood/) and setup httpd
conf this way : <Directory /prog/www/wood/>
    SetHandler perl-script
    PerlResponseHandler ModPerl::Registry
    PerlOptions +ParseHeaders
    Options +ExecCGI
</Directory>

I make it look under /images/ but it tries to read the .jpg byte per
byte like if it would be a perl file!

The best solution for me is to have all perl and html files in the root
directory, and have the images under the /images/ subdirectory, and
maybe the stylesheets in the /style/ subdirectory.

What would be the best httpd.conf configuration to do that?

Thanks a lot for your help

Best regards,

Steve Hemond
Programmeur Analyste / Analyst Programmer
Smurfit-Stone, Ressources Forestieres
La Tuque, P.Q.
Tel.: (819) 676-8100 X2833
shemond@smurfit.com 


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


Re: Handlers/locations

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> The best solution for me is to have all perl and html files in the root
> directory, and have the images under the /images/ subdirectory, and
> maybe the stylesheets in the /style/ subdirectory.
> 
> What would be the best httpd.conf configuration to do that?
> 

none of this is really a mod_perl question.  but...

the way to handle this is that each type of file needs its own <Directory>
(or <Location>, etc) container.  the SetHandler line is telling Apache that
everything in perl/ (and beneath) is to use mod_perl for content generation.

take a look at your default httpd.conf and see how it handles icons/,
manual/, and cgi-bin/ and then use that as a template for setting up your
own system.

HTH

--Geoff



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