Skip to content

Instantly share code, notes, and snippets.

@patmandenver
Created September 14, 2016 19:56
Show Gist options
  • Save patmandenver/27ca41f6635d415264b5cd90c1ef2362 to your computer and use it in GitHub Desktop.
Save patmandenver/27ca41f6635d415264b5cd90c1ef2362 to your computer and use it in GitHub Desktop.
global
log 127.0.0.1 syslog
maxconn 1000
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
option contstats
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout check 10s
###########################################
#
# HAProxy Stats page
#
###########################################
listen stats
bind *:9090
mode http
maxconn 10
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth admin:admin
###########################################
#
# Front end for all
#
###########################################
frontend ALL
bind *:80
mode http
# Define hosts
acl host_foo hdr(host) -i foo.test.10x13.com
acl host_bar hdr(host) -i bar.test.10x13.com
# Direct hosts to backend
use_backend foo if host_foo
use_backend bar if host_bar
###########################################
#
# Back end for foo
#
###########################################
backend foo
balance roundrobin
option httpchk GET /check
http-check expect rstring ^UP$
default-server inter 3s fall 3 rise 2
server server1 192.168.0.10:8080 check
server server2 192.168.0.11:8080 check
###########################################
#
# Back end for bar
#
###########################################
backend bar
balance roundrobin
option httpchk GET /check
http-check expect rstring ^UP$
default-server inter 3s fall 3 rise 2
server server1 192.168.0.12:8080 check
server server2 192.168.0.13:8080 check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment