Website Scripts And Cloud Tutorials

mod_proxy_balancer apache load balancing


Sep 19, 2010
Click to rate this tutorial!
[Total: 3 Average: 4.7]

Well, that is exactly what mod_proxy_balancer in Apache 2.2 allows you to do. It goes beyond that and can provide weighted load balancing of internal services, but it also allows you to define “hot spares” which are only used if the normal service(s) are unavailable. This is what I’m using, with a config like:

# Reverse Proxy /myapp to an internal web service, with fail-over to a hot standby
<proxy balancer://appcluster>
    # the hot standby on server2
    BalancerMember status=+H
<location /myapp>
    ProxyPass           balancer://appcluster

This config tells Apache to proxy requests for /myapp to a web service on localhost at

If that service becomes unavailable (ie: you take it down for maintenance) then it will automatically send requests to instead. The “status=+H” defines that member as a Hot Standby. When the default service is back on-line mod_proxy_balancer will pick that up within about 60 seconds or so and revert back to forwarding all requests to it.

The ProxyPassReverse directives are unrelated to the proxy balancing smarts, but are usually required if you want to handle redirects/etc properly.
Before configuring the above handlers you need to load the modules required

LoadModule status_module "/apache2.2/modules/standard/"
LoadModule proxy_balancer_module "/apache2.2/modules/standard/"


Click to rate this tutorial!
[Total: 3 Average: 4.7]

Leave a Reply

Your email address will not be published.