Apache and Lighttpd Setup – Choosing the Proxy

apache-2.2lighttpdPROXY

In a setup where you use Apache for PHP / Python scripts and lighttpd for static files, but only one listens on the outside IP address and acts as a proxy to the other listening on the loopback interface, which should be which, why, and does it matter?

Best Answer

The lighter of the two (lighttp) should be the proxy, only bothering the heavier Apache for action when a script needs running.

Unleas of course requests for static files are rare, but in that case you don't want to split the jobs between too servers anyway as you are overcomplicating things.

As an alternative have you considered running lighttp only with php and python running as FastCGI processes? While PHP as a module can be a little quicker than FCGI the difference may not be worth the hassle of running two servers and may be negated completely anyway by the proxy arrangement.

Another alternative is to have the static content served from another IP address if the server can have a second assigned, then neither set of requests need be run through a proxy. You could use a different port on the same address too, though there is a chance some of your viewers might have trouble there if they are behind very strict firewalls that won't allow the non-port-80 traffic through.

Related Topic