Skip to content

Instantly share code, notes, and snippets.

Last active Dec 12, 2015
What would you like to do?
Installation and Configuration of HAProxy
* author Huber Flores
# Download latest version of HAProxy from
# version downloaded for this tutorial
# haproxy-1.4.15.tar.gz (wget
$ tar -xvf haproxy-1.4.15.tar.gz
# Compile HAProxy
$ make TARGET=linux26 ARCH=native
# "haproxy" file is created
# Move to your preferable location
$ cp haproxy /usr/local/sbin ///usr/local/sbin is usually in $PATH, so haproxy will then be easy to run simply by typing "haproxy".
# haproxy.conf
# Create a configuration file in /etc/haproxy/haproxy.conf
$ nano /etc/haproxy/haproxy.conf
maxconn 4096
pidfile /var/run/
mode http
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
mode http
cookie DRAGONFLY insert
balance roundrobin
option httpclose
option forwardfor
stats enable
stats auth myuser:mypass
server Server1 cookie DRAGONFLY_Server_01 check
server Server2 cookie DRAGONFLY_Server_02 check
server ServerN cookie DRAGONFLY_Server_N check
Start HAProxy
haproxy -f /etc/haproxy/haproxy.conf
Statistics about HAProxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment