| Debian Apache2 as reverse proxy to Debian Apache2 [message #91159] |
Thu, 17 November 2011 22:24  |
|
Instead of using a non-distro webserver as a reverse proxy, I looked in to doing this purely with Apache2. Debian made this easy, but will also look into it with CentOS.
The idea is that a light-weight apache2 would listen on eth0 and server static content and if a request for a php page is made, it sends it to the heavy-weight apache2.
In Debian the init.d script is written to use its own name to find the conf files. This makes running 2 apache2 instances very easy.
cp /etc/init.d/apache2 /etc/init.d/apache2-light
cp -r /etc/apache2 /etc/apache2.bak
cp -r /etc/apache2 /etc/apache2-light
mkdir /var/log/apache2-light/
touch /var/log/apache2-light/error.log
You then have to edit the apache2 ports.conf and virtual host confs to listen only on 127.0.0.1.
Do the same for apache2-light, but use your external IP address.
Set the reverse proxy from apache2-light to send only php requests to 127.0.0.1.
Disable mod_php on apache2-light.
Enable APC on php.
With 1GB of memory and a heavy PHP ( apache2 uses 50 MB with APC enabled), I set my apache2 to 15 clients and my apache2-light to 50. Also I can now enable Keep Alive on the light.
My next goal is to have the light use worker, though the heavy must always use prefork to work well with PHP.
Any one interested in a full write up and will try this out?
https://www.mercuryvps.com
HyperVM Xen VPS hosting
|
|
|
|
|
|
|
|