the scripts under mod_perl are running as mod_cgi
[prev]
[thread]
[next]
[Date index for 2004/12/01]
--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) & 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> </DIV>
<DIV> [Wed Nov 24 02:53:55 2004] [notice] Apache/1.3.33 (Unix) mod_perl/1.29 configured -- resuming normal operations<BR> [Wed Nov 24 02:53:55 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)</DIV>
<DIV> </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> </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> </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> </DIV>
<DIV>++++++++++++++++++++++<BR>++ httpd.conf - start ++<BR>++++++++++++++++++++++</DIV>
<DIV> LoadModule proxy_add_forward_module libexec/mod_proxy_add_forward.so<BR> LoadModule proxy_module libexec/mod_proxy.so<BR> <BR> <BR> AddModule mod_proxy_add_forward.c<BR> AddModule mod_proxy.c<BR> <BR> <BR> <IfModule mod_proxy.c><BR> ProxyRequests On<BR> ProxyPass /perl/ <A href="http://localhost:8000/cgi-bin/">http://localhost:8000/cgi-bin/</A><BR> ProxyPassReverse /perl/ <A href="http://localhost:8000/cgi-bin/">http://localhost:8000/cgi-bin/</A><BR> </ifModule><BR> <BR> # I added the following line inside the '<VirtualHost xxx.xx.xx.xxx>' tag<BR> <BR> <VirtualHost xx.xx.xx.xxx:80><BR> ........<BR> ........<BR> Alias /perl/ /home/user-name/public_html/cgi-bin/<BR> ........<BR> ........<BR> </<VirtualHost><BR> </DIV>
<DIV>++++++++++++++++++++++<BR>++ httpd.conf - end ++<BR>++++++++++++++++++++++</DIV>
<DIV>Here is the backend config file for mod_perl enabled server...</DIV>
<DIV>++++++++++++++++++++++<BR>++ httpd_perl.conf - start ++<BR>++++++++++++++++++++++</DIV>
<DIV> BindAddress 127.0.0.1<BR> <BR> port 8000</DIV>
<DIV><BR> ##### mod_perl settings#####</DIV>
<DIV> PerlRequire /usr/local/httpd_perl/conf/startup.pl<BR> PerlFixupHandler Apache::SizeLimit<BR> PerlPostReadRequestHandler Book::ProxyRemoteAddr<BR> PerlSetupEnv Off<BR> <BR> <BR> Listen 8000<BR> <VirtualHost localhost:8000><BR> ServerAlias <A href="http://www.mydomain.com">www.mydomain.com</A> mydomain.com<BR> ServerAdmin <A href="mailto:webmaster@xxxxxxxx.xxx">webmaster@xxxxxxxx.xxx</A><BR> ServerName <A href="http://www.mydomain.com">www.mydomain.com</A><BR> DocumentRoot /home/user-name/public_html<BR> DirectoryIndex index.shtml index.html<BR> <BR> ScriptAlias /cgi-bin/ /home/user-name/public_html/cgi-bin/<BR> Alias /perl/ /home/user-name/public_html/cgi-bin/<BR> PerlModule Apache::Registry<BR> <BR> <Location
/perl><BR> SetHandler perl-script<BR> PerlHandler Apache::Registry<BR> PerlSendHeader On<BR> Options +ExecCGI<BR> Allow from all<BR> </Location><BR> </VirtualHost></DIV>
<DIV>++++++++++++++++++++++<BR>++ httpd_perl.conf - end ++<BR>++++++++++++++++++++++</DIV>
<DIV>##################<BR>## startup.pl - start ##<BR>##################</DIV>
<DIV> #!perl<BR> <BR> unless (defined $ENV{MOD_PERL}) {<BR> die "\$ENV{MOD_PERL} not set!";<BR> }<BR> <BR> use Apache::Constants ();<BR> <BR> sub My::ProxyRemoteAddr ($) {<BR> my $r = shift;<BR> <BR> # we'll only look at the X-Forwarded-For header if the requests<BR> # comes from our proxy at localhost<BR> <BR> return Apache::Constants::OK <BR> unless ($r->connection->remote_ip eq "127.0.0.1") <BR> and $r->header_in('X-Forwarded-For');<BR> <BR> # Select last value in the chain -- original client's ip<BR> if (my ($ip) = $r->headers_in->{'X-Forwarded-For'} =~ /([^,\s]+)$/)
{<BR> $r->connection->remote_ip($ip);<BR> }<BR> <BR> return Apache::Constants::OK;<BR> }<BR> 1;</DIV>
<DIV>##################<BR>## startup.pl -end ##<BR>##################</DIV>
<DIV>##########################<BR>## ProxyRemoteAddr - start ##<BR>##########################</DIV>
<DIV> package Book::ProxyRemoteAddr;<BR> <BR> use Apache::Constants qw(OK);<BR> use strict;<BR> <BR> sub handler {<BR> my $r = shift;<BR> <BR> # we'll only look at the X-Forwarded-For header if the request<BR> # comes from our proxy at localhost<BR> return OK unless ($r->connection->remote_ip eq "127.0.0.1") &&<BR> $r->header_in('X-Forwarded-For');<BR> <BR> # Select last value in the chain -- original client's IP<BR> if (my ($ip) = $r->headers_in->{'X-Forwarded-For'} =~ /([^,\s]+)$/) {<BR> $r->connection->remote_ip($ip);<BR> }<BR> <BR> return OK;<BR> }<BR> 1;</DIV>
<DIV>##########################<BR>## ProxyRemoteAddr - end ##<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
|