Simple LoadBalancer HaProxy

Setup a simple Load Balancer using HaProxy :

apt-get install haproxy

Edit /etc/default/haproxy and set ENABLED to 1

Simple configuration file /etc/haproxy/haproxy.cfg

        maxconn 4096 # Total Max Connections. This is dependent on ulimit
        nbproc 1 # Number of processing cores. Dual Dual-core Opteron is 4 cores for example.
        user haproxy
        group haproxy

        mode http
        clitimeout 60000
        srvtimeout 30000
        contimeout 4000
        option httpclose # Disable Keepalive

listen http_proxy PROXY.IP:80
        balance roundrobin # Load Balancing algorithm
        option httpchk
        option forwardfor # This sets X-Forwarded-For
        ## Define your servers to balance
        server web1 WEBIP_1:80 weight 1 maxconn 512 check
        server web2 WEBIP_2:80 weight 1 maxconn 512 check
        server web3 WEBIP_3:80 weight 1 maxconn 512 check