Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache config: can only display .cgi files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
luca
Guru
Guru


Joined: 11 Feb 2004
Posts: 374

PostPosted: Wed May 17, 2006 2:41 pm    Post subject: Apache config: can only display .cgi files Reply with quote

Hi All

I think I need some help with my apache2 configuration. When I try to display, lets say index.html, I get an Internal Server Error.
Here is my 00_default_vhost.conf:
Code:
<VirtualHost *:80>
   <IfModule mod_perl.c>
         <Directory /opt/www>
           SetHandler perl-script
           PerlResponseHandler ModPerl::PerlRun
           Options -Indexes +ExecCGI
      <IfDefine MODPERL2>
           PerlOptions +ParseHeaders
      </IfDefine>
           <IfDefine !MODPERL2>
                 PerlSendHeader On
           </IfDefine>
          </Directory>
         </IfModule>
    #
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    DocumentRoot "/opt/www/"
   <IfModule peruser.c>
        # this must match a Processor
        ServerEnvironment apache apache
       
        # these are optional - defaults to the values specified in httpd.conf
        MinSpareProcessors 4
        MaxProcessors 20
    </IfModule>
    #<IfModule mod_perl.c>
       #<Files *.pl>
        #SetHandler perl-script
        #PerlResponseHandler ModPerl::Registry
        #Options -Indexes ExecCGI
        #PerlSendHeader On
       #</Files>
    #</IfModule>
</VirtualHost>


Here are also some parts from httpd.conf:
Code:
<Directory />
    Options FollowSymLinks +ExecCGI
    AllowOverride None
</Directory>

ScriptAlias /cgi-bin /opt/www/


So, I can run index.cgi (/opt/www, but I also see some problems with my .css file) but I cannot run index.html !

Any suggestions ?

Thanks a lot
Luca
Back to top
View user's profile Send private message
bin-doph
Guru
Guru


Joined: 23 May 2003
Posts: 302

PostPosted: Fri May 19, 2006 1:56 pm    Post subject: Re: Apache config: can only display .cgi files Reply with quote

luca wrote:
Hi All

I think I need some help with my apache2 configuration. When I try to display, lets say index.html, I get an Internal Server Error.
Here is my 00_default_vhost.conf:
Code:
<VirtualHost *:80>
   <IfModule mod_perl.c>
         <Directory /opt/www>
           SetHandler perl-script
           PerlResponseHandler ModPerl::PerlRun
           Options -Indexes +ExecCGI
      <IfDefine MODPERL2>
           PerlOptions +ParseHeaders
      </IfDefine>
...rest of config...
</VirtualHost>


there you say "All files in /opt/www should be called as perl-scripts" with that SetHandler, which is not what you want.

option 1

Create a cgi-bin-directory and put all your stuff in there. connect that directory to the perl-script-Handler

option 2

set default handler to text/html and add a location-match, for example
Code:
 SetHandler text/html
<LocationMatch "/*.cgi">
    SetHandler  perl-script
</LocationMatch>


untested, but should do I guess

hth
-fe
_________________
perl -e '$_=q;4a75737420616e6f74686572205065726c204861636b65720as;;for(s;s;s;s;s;s;s;s;s;s;s;s){s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'
Back to top
View user's profile Send private message
luca
Guru
Guru


Joined: 11 Feb 2004
Posts: 374

PostPosted: Mon May 22, 2006 7:13 am    Post subject: Reply with quote

Thanks a lot, your untested code worked very well!!
Now my 00_default_vhost.conf looks like:
Code:

<VirtualHost *:80>
   <IfModule mod_perl.c>
         <Directory /opt/www>
           #SetHandler perl-script
           PerlResponseHandler ModPerl::PerlRun
           Options -Indexes +ExecCGI
      <IfDefine MODPERL2>
           PerlOptions +ParseHeaders
      </IfDefine>
           <IfDefine !MODPERL2>
                 PerlSendHeader On
           </IfDefine>
          </Directory>
         </IfModule>

     SetHandler text/html
   <LocationMatch "/*.cgi">
          SetHandler  perl-script
   </LocationMatch>

      DocumentRoot "/opt/www/"
...


Luca
Back to top
View user's profile Send private message
bin-doph
Guru
Guru


Joined: 23 May 2003
Posts: 302

PostPosted: Mon May 22, 2006 9:51 am    Post subject: Reply with quote

I think you could remove that SetHandler text/html, it should be the default if you dont overwrite it somewhere else.

gth
-fe
_________________
perl -e '$_=q;4a75737420616e6f74686572205065726c204861636b65720as;;for(s;s;s;s;s;s;s;s;s;s;s;s){s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum