Centos 7 – Part 2 – HAProxy combined with NGINX Load Balancing.

In this previous post instructions were written on how to setup a Round Robin Load Balancer by using NGINX and a virtual IP that would pass requests to the Apache Web Servers.

In this post we will use the very same setup but we place a HAProxy server in front of the Virtual IP the NGINX servers created. This server will use the Round Robin protocol as well and it will pass the requests to the NGINX servers which will in return will pass the web requests to the Apache web servers. SSL is not yet implemented.

The IP address of the HAProxy is and the IP address of the virtual IP we created is with a DNS entry “wordpressvirtip”
















yum install haproxy
vi /etc/haproxy/haproxy.cfg
        log   local0
        log   local1 debug
        maxconn   45000 # Total Max Connections.
        nbproc      1 # Number of processing cores.
        timeout server 86400000
        timeout connect 86400000
        timeout client 86400000
        timeout queue   1000s

# [HTTP Site Configuration]
listen  http_web
        mode http
        balance roundrobin  # Load Balancing algorithm
        option httpchk
        option forwardfor
        server wordpressvirtip weight 1 maxconn 512 check
        #server server2 weight 1 maxconn 512 check

# [HTTPS Site Configuration]
#listen  https_web
#        mode tcp
#        balance source# Load Balancing algorithm
#        reqadd X-Forwarded-Proto:\ http
#        server server1 weight 1 maxconn 512 check
#        server server2 weight 1 maxconn 512 check
 system start haproxy
Share Button