the scripts under mod_perl are running as mod_cgi

[prev] [thread] [next] [Date index for 2004/12/01]

From: SHAHNAWAZ OSMAN
Subject: the scripts under mod_perl are running as mod_cgi
Date: 11:16 on 01 Dec 2004
--0-1300282799-1101899796=:46559
Content-Type: text/plain; charset=us-ascii

Hi! I have been trying to configure two servers under Linux (CentOS-3.3) - one vanilla (frontend) & one mod_perl (backend) enabled server with a proxy setting in the front end. The frontend server is on port: 80 and the backend is on port 8000 and they are both in the same IP. The installation seems successful and the error log is as follows:
 
  [Wed Nov  24 02:53:55 2004] [notice] Apache/1.3.33 (Unix) mod_perl/1.29 configured -- resuming normal operations
  [Wed Nov  24 02:53:55 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)
 
I can also verify that mod_perl is installed by typing 'httpd -l'. Anyway, the configuration became a real pain since all I can get is only "running under mod_cgi" - if I run the following script:
 
-----------------------------------------------------------------------------------------
#!/usr/bin/perl 
print "Content-type: text/plain\n\n"; 
print "running under mod_" . ($ENV{MOD_PERL} ? "perl" : "cgi"); 
-----------------------------------------------------------------------------------------
 
I am really confused and can't figure out a solution so far. I tried to follow the guideline and reading a lot in the last few days but I don't seem to find a clue. I would really appreciate, if you guys can point out - what am I doing wrong here. Thank you in advance.
Here are my settings...

This is the frontend configuration setting...
 
++++++++++++++++++++++
++  httpd.conf - start            ++
++++++++++++++++++++++
 LoadModule proxy_add_forward_module  libexec/mod_proxy_add_forward.so
 LoadModule proxy_module       libexec/mod_proxy.so
 
 
 AddModule mod_proxy_add_forward.c
 AddModule mod_proxy.c
 
 
 <IfModule mod_proxy.c>
 ProxyRequests On
 ProxyPass /perl/ http://localhost:8000/cgi-bin/
 ProxyPassReverse /perl/ http://localhost:8000/cgi-bin/
 </ifModule>
 
 # I added the following line inside the '<VirtualHost xxx.xx.xx.xxx>' tag
 
 <VirtualHost xx.xx.xx.xxx:80>
 ........
 ........
 Alias /perl/ /home/user-name/public_html/cgi-bin/
 ........
 ........
 </<VirtualHost>
 
++++++++++++++++++++++
++  httpd.conf - end             ++
++++++++++++++++++++++
Here is the backend config file for mod_perl enabled server...
++++++++++++++++++++++
++ httpd_perl.conf - start ++
++++++++++++++++++++++
 BindAddress 127.0.0.1
 
 port 8000

 ##### mod_perl settings#####
 PerlRequire         /usr/local/httpd_perl/conf/startup.pl
 PerlFixupHandler      Apache::SizeLimit
 PerlPostReadRequestHandler Book::ProxyRemoteAddr
 PerlSetupEnv        Off
 
  
 Listen 8000
 <VirtualHost localhost:8000>
 ServerAlias www.mydomain.com mydomain.com
 ServerAdmin webmaster@xxxxxxxx.xxx
 ServerName www.mydomain.com
 DocumentRoot /home/user-name/public_html
 DirectoryIndex index.shtml index.html
 
 ScriptAlias /cgi-bin/ /home/user-name/public_html/cgi-bin/
 Alias /perl/ /home/user-name/public_html/cgi-bin/
 PerlModule Apache::Registry
 
 <Location /perl>
 SetHandler perl-script
 PerlHandler Apache::Registry
 PerlSendHeader On
 Options +ExecCGI
 Allow from all
 </Location>
 </VirtualHost>
++++++++++++++++++++++
++ httpd_perl.conf - end      ++
++++++++++++++++++++++
##################
##  startup.pl - start ##
##################
 #!perl
 
 unless (defined $ENV{MOD_PERL}) {
     die "\$ENV{MOD_PERL} not set!";
 }
 
 use Apache::Constants ();
   
 sub My::ProxyRemoteAddr ($) {
     my $r = shift;
    
     # we'll only look at the X-Forwarded-For header if the requests
     # comes from our proxy at localhost
     
     return Apache::Constants::OK 
         unless ($r->connection->remote_ip eq "127.0.0.1") 
             and $r->header_in('X-Forwarded-For');
   
     # Select last value in the chain -- original client's ip
     if (my ($ip) = $r->headers_in->{'X-Forwarded-For'} =~ /([^,\s]+)$/) {
       $r->connection->remote_ip($ip);
     }
         
     return Apache::Constants::OK;
   }
 1;
##################
##  startup.pl -end   ##
##################
##########################
##  ProxyRemoteAddr - start  ##
##########################
 package Book::ProxyRemoteAddr;
 
 use Apache::Constants qw(OK);
 use strict;
 
 sub handler {
     my $r = shift;
 
     # we'll only look at the X-Forwarded-For header if the request
     # comes from our proxy at localhost
     return OK unless ($r->connection->remote_ip eq "127.0.0.1") &&
         $r->header_in('X-Forwarded-For');
 
     # Select last value in the chain -- original client's IP
     if (my ($ip) = $r->headers_in->{'X-Forwarded-For'} =~ /([^,\s]+)$/) {
         $r->connection->remote_ip($ip);
     }
 
     return OK;
 }
 1;
##########################
##  ProxyRemoteAddr - end   ##
##########################



---------------------------------
Post your free ad now! Yahoo! Canada Personals

--0-1300282799-1101899796=:46559
Content-Type: text/html; charset=us-ascii

<DIV>Hi! I have been trying to configure two servers under Linux (CentOS-3.3) - one vanilla (frontend) &amp; one mod_perl (backend) enabled server with a proxy setting in the front end. The frontend server is on port: 80 and the backend is on port 8000 and they are both in the same IP. The installation seems successful and the error log is as follows:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;[Wed Nov&nbsp; 24 02:53:55 2004] [notice] Apache/1.3.33 (Unix) mod_perl/1.29 configured -- resuming normal operations<BR>&nbsp;&nbsp;[Wed Nov&nbsp; 24 02:53:55 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)</DIV>
<DIV>&nbsp;</DIV>
<DIV>I can also verify that mod_perl is installed by typing 'httpd -l'. Anyway, the configuration became a real pain since all I can get is only "running under mod_cgi" - if I run the following script:</DIV>
<DIV>&nbsp;</DIV>
<DIV>-----------------------------------------------------------------------------------------<BR>#!/usr/bin/perl <BR>print "Content-type: text/plain\n\n"; <BR>print "running under mod_" . ($ENV{MOD_PERL} ? "perl" : "cgi"); </DIV>
<DIV>-----------------------------------------------------------------------------------------</DIV>
<DIV>&nbsp;</DIV>
<DIV>I am really confused and can't figure out a solution so far. I tried to follow the guideline and reading a lot in the last few days but I don't seem to find a clue. I would really appreciate, if you guys can point out - what am I doing wrong here. Thank you in advance.</DIV>
<DIV>Here are my settings...</DIV>
<DIV><BR>This is the frontend configuration setting...</DIV>
<DIV>&nbsp;</DIV>
<DIV>++++++++++++++++++++++<BR>++&nbsp;&nbsp;httpd.conf - start&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++<BR>++++++++++++++++++++++</DIV>
<DIV>&nbsp;LoadModule proxy_add_forward_module&nbsp; libexec/mod_proxy_add_forward.so<BR>&nbsp;LoadModule proxy_module&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libexec/mod_proxy.so<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;AddModule mod_proxy_add_forward.c<BR>&nbsp;AddModule mod_proxy.c<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;&lt;IfModule mod_proxy.c&gt;<BR>&nbsp;ProxyRequests On<BR>&nbsp;ProxyPass /perl/ <A href="http://localhost:8000/cgi-bin/">http://localhost:8000/cgi-bin/</A><BR>&nbsp;ProxyPassReverse /perl/ <A href="http://localhost:8000/cgi-bin/">http://localhost:8000/cgi-bin/</A><BR>&nbsp;&lt;/ifModule&gt;<BR>&nbsp;<BR>&nbsp;# I added the following line inside the '&lt;VirtualHost xxx.xx.xx.xxx&gt;' tag<BR>&nbsp;<BR>&nbsp;&lt;VirtualHost xx.xx.xx.xxx:80&gt;<BR>&nbsp;........<BR>&nbsp;........<BR>&nbsp;Alias /perl/ /home/user-name/public_html/cgi-bin/<BR>&nbsp;........<BR>&nbsp;........<BR>&nbsp;&lt;/&lt;VirtualHost&gt;<BR>&nbsp;</DIV>
<DIV>++++++++++++++++++++++<BR>++&nbsp;&nbsp;httpd.conf - end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++<BR>++++++++++++++++++++++</DIV>
<DIV>Here is the backend config file for mod_perl enabled server...</DIV>
<DIV>++++++++++++++++++++++<BR>++&nbsp;httpd_perl.conf - start&nbsp;++<BR>++++++++++++++++++++++</DIV>
<DIV>&nbsp;BindAddress 127.0.0.1<BR>&nbsp;<BR>&nbsp;port 8000</DIV>
<DIV><BR>&nbsp;##### mod_perl settings#####</DIV>
<DIV>&nbsp;PerlRequire&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/local/httpd_perl/conf/startup.pl<BR>&nbsp;PerlFixupHandler&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Apache::SizeLimit<BR>&nbsp;PerlPostReadRequestHandler&nbsp;Book::ProxyRemoteAddr<BR>&nbsp;PerlSetupEnv&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Off<BR>&nbsp;<BR>&nbsp;&nbsp;<BR>&nbsp;Listen 8000<BR>&nbsp;&lt;VirtualHost localhost:8000&gt;<BR>&nbsp;ServerAlias <A href="http://www.mydomain.com">www.mydomain.com</A>; mydomain.com<BR>&nbsp;ServerAdmin <A href="mailto:webmaster@xxxxxxxx.xxx">webmaster@xxxxxxxx.xxx</A><BR>&nbsp;ServerName <A href="http://www.mydomain.com">www.mydomain.com</A><BR>&nbsp;DocumentRoot /home/user-name/public_html<BR>&nbsp;DirectoryIndex index.shtml index.html<BR>&nbsp;<BR>&nbsp;ScriptAlias /cgi-bin/ /home/user-name/public_html/cgi-bin/<BR>&nbsp;Alias /perl/ /home/user-name/public_html/cgi-bin/<BR>&nbsp;PerlModule Apache::Registry<BR>&nbsp;<BR>&nbsp;&lt;Location
 /perl&gt;<BR>&nbsp;SetHandler perl-script<BR>&nbsp;PerlHandler Apache::Registry<BR>&nbsp;PerlSendHeader On<BR>&nbsp;Options +ExecCGI<BR>&nbsp;Allow from all<BR>&nbsp;&lt;/Location&gt;<BR>&nbsp;&lt;/VirtualHost&gt;</DIV>
<DIV>++++++++++++++++++++++<BR>++&nbsp;httpd_perl.conf - end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++<BR>++++++++++++++++++++++</DIV>
<DIV>##################<BR>##&nbsp; startup.pl - start ##<BR>##################</DIV>
<DIV>&nbsp;#!perl<BR>&nbsp;<BR>&nbsp;unless (defined $ENV{MOD_PERL}) {<BR>&nbsp;&nbsp;&nbsp;&nbsp; die "\$ENV{MOD_PERL} not set!";<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;use Apache::Constants ();<BR>&nbsp;&nbsp; <BR>&nbsp;sub My::ProxyRemoteAddr ($) {<BR>&nbsp;&nbsp;&nbsp;&nbsp; my $r = shift;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; # we'll only look at the X-Forwarded-For header if the requests<BR>&nbsp;&nbsp;&nbsp;&nbsp; # comes from our proxy at localhost<BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; return Apache::Constants::OK <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unless ($r-&gt;connection-&gt;remote_ip eq "127.0.0.1") <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and $r-&gt;header_in('X-Forwarded-For');<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; # Select last value in the chain -- original client's ip<BR>&nbsp;&nbsp;&nbsp;&nbsp; if (my ($ip) = $r-&gt;headers_in-&gt;{'X-Forwarded-For'} =~ /([^,\s]+)$/)
 {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $r-&gt;connection-&gt;remote_ip($ip);<BR>&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; return Apache::Constants::OK;<BR>&nbsp;&nbsp; }<BR>&nbsp;1;</DIV>
<DIV>##################<BR>##&nbsp; startup.pl -end&nbsp;&nbsp; ##<BR>##################</DIV>
<DIV>##########################<BR>##&nbsp; ProxyRemoteAddr - start&nbsp; ##<BR>##########################</DIV>
<DIV>&nbsp;package Book::ProxyRemoteAddr;<BR>&nbsp;<BR>&nbsp;use Apache::Constants qw(OK);<BR>&nbsp;use strict;<BR>&nbsp;<BR>&nbsp;sub handler {<BR>&nbsp;&nbsp;&nbsp;&nbsp; my $r = shift;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; # we'll only look at the X-Forwarded-For header if the request<BR>&nbsp;&nbsp;&nbsp;&nbsp; # comes from our proxy at localhost<BR>&nbsp;&nbsp;&nbsp;&nbsp; return OK unless ($r-&gt;connection-&gt;remote_ip eq "127.0.0.1") &amp;&amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $r-&gt;header_in('X-Forwarded-For');<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; # Select last value in the chain -- original client's IP<BR>&nbsp;&nbsp;&nbsp;&nbsp; if (my ($ip) = $r-&gt;headers_in-&gt;{'X-Forwarded-For'} =~ /([^,\s]+)$/) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $r-&gt;connection-&gt;remote_ip($ip);<BR>&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; return OK;<BR>&nbsp;}<BR>&nbsp;1;</DIV>
<DIV>##########################<BR>##&nbsp; ProxyRemoteAddr - end&nbsp;&nbsp; ##<BR>##########################</DIV><p><br><hr size=1>Post your free ad now! <a href="http://ca.personals.yahoo.com/"><b>Yahoo! Canada Personals</b></a><br>
--0-1300282799-1101899796=:46559--

the scripts under mod_perl are running as mod_cgi
SHAHNAWAZ OSMAN 11:16 on 01 Dec 2004

Re: the scripts under mod_perl are running as mod_cgi
SHAHNAWAZ OSMAN 04:29 on 02 Dec 2004

Re: the scripts under mod_perl are running as mod_cgi
INFOQUEST USA INC. 08:26 on 02 Dec 2004

Re: the scripts under mod_perl are running as mod_cgi
SHAHNAWAZ OSMAN 07:02 on 03 Dec 2004

Re: the scripts under mod_perl are running as mod_cgi
INFOQUEST USA INC 23:38 on 03 Dec 2004

Re: the scripts under mod_perl are running as mod_cgi
INFOQUEST USA INC 00:03 on 04 Dec 2004

Re: the scripts under mod_perl are running as mod_cgi
SHAHNAWAZ OSMAN 06:54 on 03 Dec 2004

Generated at 11:27 on 21 Dec 2004 by mariachi v0.52