One minute
Load Balancing via mod_proxy_balancer in Apache
Configuring load balancing in Apache was, at first pass, a little cumbersome largely because I couldn’t find any relevant examples to what I was trying to do that were inclusive inside a Virtual Host.
So without further ado, here is a configuraton with sticky session round robin load balancing in Apache within a Virtual Host:
<VirtualHost *:80>
ServerName hearn.us
ServerAlias hearn.us *.hearn.us
DocumentRoot /var/www/html
ErrorLog logs/error_hearn.us.log
CustomLog logs/access_hearn.us.log combined
ProxyPreserveHost On
ProxyRequests Off
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://hearn.us_cluster>
BalancerMember http://vcosbackend1:80 route=1 # first node
BalancerMember http://vcosbackend2:80 route=2 # second node
Order Deny,Allow
Allow from all
ProxySet stickysession=ROUTEID
</Proxy>
ProxyPass / balancer://hearn.us_cluster/
</VirtualHost>
Read other posts