You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Denis Banovic <de...@ncm.at> on 2005/09/06 16:37:30 UTC

Reverse proxy

Hi everybody!

I have a simple reverse proxy question that might be slightly off topic
and I apologise for that!

Do you have to run 2 instances of apache when you want to profit from
the reverse proxy configuration?
Or is it enough to have 2 different Virtual Server running?

Thanks

Denis

Here is my config:
### Frontend
<VirtualHost 192.168.200.178:80>
DocumentRoot /home/vservers/mymon/
ServerName  frontend.test.at
RewriteEngine On
RewriteCond   %{REQUEST_URI} ^(.*)[^\.js]$ ### match anything except .js
files
RewriteRule /(.*?)$ http://127.0.0.1:8330/$1 [P]
<Location />
Options FollowSymLinks ExecCGI Includes
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
</Location>
</VirtualHost>

### Backend Server with mod_perl 
<VirtualHost 127.0.0.1:8330>
DocumentRoot /home/vservers/knowledge_base/
ServerName  backend.test.at
<Location />
Options FollowSymLinks ExecCGI Includes
PerlResponseHandler ModPerl::Registry
AddHandler perl-script .pl
</Location>
</VirtualHost>

Re: Reverse proxy

Posted by Jonathan Vanasco <jv...@mastersofbranding.com>.
On Sep 6, 2005, at 11:33 AM, Perrin Harkins wrote:

> Two separate instances with mod_perl 1 or mod_perl 2 in prefork  
> MPM.  It
> may be possible to set up pooling of interpreters to get a similar
> benefit without multiple servers when using mod_perl 2 with  
> threads, but
> I haven't tried this.

To  elaborate:

The  benefit of the proxy setup is that you have a stripped down  
'vanilla' apache serving static files and proxying to a tricked out  
mod_perl apache, which uses considerably more memory per process.  By  
running the proxy, vanilla apache serves static files super fast and  
essentially serves mp2 content off of the proxied server as static.   
the mp2 server only has to work on generating dynamic content and is  
more often available to do that then if it were constantly using a  
connection to server static files.

if you run both off of a virtualhost, then you're just having an  
apache configuration proxying to itself (which should be slower than  
either using 2 different apaches or just using a virtual host without  
proxy)

You don't need to use apache as a the proxy though - you could use  
squid or lighttpd

There's a really good discussion of this in  Practical mod_perl By  
Stas Bekman, Eric Cholet

Re: Reverse proxy

Posted by Perrin Harkins <pe...@elem.com>.
On Tue, 2005-09-06 at 16:37 +0200, Denis Banovic wrote:
> Do you have to run 2 instances of apache when you want to profit from
> the reverse proxy configuration?
> Or is it enough to have 2 different Virtual Server running?

Two separate instances with mod_perl 1 or mod_perl 2 in prefork MPM.  It
may be possible to set up pooling of interpreters to get a similar
benefit without multiple servers when using mod_perl 2 with threads, but
I haven't tried this.

- Perrin