Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Created January 8, 2019 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ilgrim/05b4fc58e21417982ce9bfc6206b4a89 to your computer and use it in GitHub Desktop.
Save Ilgrim/05b4fc58e21417982ce9bfc6206b4a89 to your computer and use it in GitHub Desktop.
simple haproxy.cfg config
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
nbproc 4
daemon
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode http
log global
option dontlognull
option httpclose
option httplog
option forwardfor
option redispatch
timeout connect 10000 # default 10 second time out if a backend is not found
timeout client 300000
timeout server 300000
maxconn 60000
retries 3
#---------------------------------------------------------------------
# Listen webfarm
#---------------------------------------------------------------------
listen webfarm 10.0.1.10:80
mode http
stats enable
stats uri /stats
stats realm HAProxy\ Statistics
stats auth admin:P@szw03dz
balance roundrobin
cookie JSESSIONID prefix
option httpclose
option forwardfor
option httpchk HEAD /check.txt HTTP/1.0
server server1.yourserver.com 10.0.1.11:80 cookie A check
server server2.yourserver.com 10.0.1.12:80 cookie B check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment