In this tutorial we’ll install the Debian Linux 9 (squeeze), Apache 2 with mpm-itk (to run each web as a isolated user),...
Simple load balancing using Pound
Ástþór IPThe Pound program is a reverse proxy, load balancer and HTTPS front-end for Web server(s). Pound was developed to enable distributing the load among several Web-servers and to allow for a convenient SSL wrapper for those Web servers that do not offer it natively.
1. Install the pound package
apt-get install pound
2. Configure the load balancing. Replace everything below and including ListenHTTP with something like this: (pico /etc/pound/pound.cfg)
ListenHTTP
Address 0.0.0.0
Port 80
xHTTP 0
Service
HeadRequire "Host: .*www.google.com.*"
BackEnd
Address 209.85.227.103
Port 80
End
BackEnd
Address 209.85.227.104
Port 80
End
BackEnd
Address 209.85.227.105
Port 80
End
BackEnd
Address 209.85.227.106
Port 80
End
End
End
In this example we’ll be listening for www.google.com and forward requests to 4 of Google’s web servers/clusters. You can of course replace the domain with one of your own and point it to any servers. The servers can be on different networks, using different platforms and you can even forward different paths to different servers. Ex. www.google.com/apps could be forwarded to 1.2.3.4 while www.google.com is forwarded to 2.3.4.5. Click here for more details about Pound
3. Enable the Pound service (pico /etc/default/pound)
startup=1
4. Restart Pound
/etc/init.d/pound start
You must point the dns record for www.google.com to your server’s IP address. You could use the hosts file to do this or use another domain.