How to setup squid proxy as load balancer

What is the Reverse Proxy (httpd-accelerator) mode? 

An accelerator caches incoming requests for outgoing data (i.e., that which you publish to the world). It takes load away from your HTTP server and internal network. You move the server away from port 80 (or whatever your published port is), and substitute the accelerator, which then pulls the HTTP data from the "real" HTTP server (only the accelerator needs to know where the real server is). The outside world sees no difference (apart from an increase in speed, with luck).

How do I set it up?

Several configurations are possible. The ConfigExamples section details several variations of Reverse Proxy.

Running the web server on the same server

While not generally recommended it is possible to run both the accelerator and the backend web server on the same host. To do this you need to make them listen on different IP addresses. Usually the loopback address ( or ::1) is used for the web server.
In Squid this is done by specifying the public IP address in http_port, and using loopback address for the web server
http_port the.public.ip.address:80 accel
cache_peer parent 80 0 no-query originserver
AndApache may be configured like in httpd.conf to listen on the loopback address:
Port 80
Other web servers uses similar directives specifying the address where it should listen for requests. See the manual to your web server for details.

Load balancing of backend servers

To load balance requests among a set of backend servers allow requests to be forwarded to more than one cache_peer, and use one of the load balancing options in the cache_peer lines. I.e. the round-robin option.
cache_peer ip.of.server1 parent 80 0 no-query originserver round-robin
cache_peer ip.of.server2 parent 80 0 no-query originserver round-robin
Other load balancing methods is also available. See squid.conf.default for the full the description of the cache_peer directive options.

Source :




alex zandar said...

Nice blog, just looking around some blogs, seems a pretty nice platform you are using. I'm currently using Wordpress for a few of my sites but looking to change one of them over to a platform similar to yours as a trial run.
Affordable Web Design Services

PHP developer Cochin |PHP developer Kerala | PHP developer India | Flash developer/programmer Cochin | Flash developer/programmer Kerala | Flash developer/programmer India | web programmer kerala |web programmer Cochin |web programmer India |web developer kerala |Web developer Cochin | Kerala PHP | PHP freelancer| flash actionscript freelancer