Created
January 16, 2012 22:28
-
-
Save flores/1623381 to your computer and use it in GitHub Desktop.
sample haproxy.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
log 127.0.0.1 local0 notice | |
maxconn 50000 | |
daemon | |
stats socket /tmp/proxystats level admin | |
defaults | |
log global | |
mode http | |
option httplog | |
option dontlognull | |
stats enable | |
stats uri /proxystats | |
stats auth some:supersecretcredential | |
stats refresh 5s | |
contimeout 120000 | |
clitimeout 120000 | |
srvtimeout 120000 | |
option redispatch | |
option forwardfor | |
option http-server-close | |
frontend http | |
bind :80 | |
acl correctdomain hdr(host) www.ourdomain.com | |
acl static url_reg (html|js|css|png|jpg|gif)$ | |
acl static url_beg /static | |
acl api url_beg /api | |
acl mobile url_beg /mobile | |
acl blog url_beg /blog | |
redirect location http://www.ourdomain.com if !correctdomain | |
use_backend static if static | |
use_backend api if api | |
use_backend mobile if mobile | |
use_backend blog if blog | |
default_backend static # lets let the static servers handle 404s and junk | |
frontend redis | |
mode tcp | |
bind :6379 | |
server redis-master 10.10.1.1:6379 check | |
server redis-hotspare 10.10.1.2:6380 check disabled | |
frontend mysql | |
mode tcp | |
bind :3306 | |
balance source | |
server mysql-master 10.10.2.1:3306 check | |
server mysql-slave 10.10.2.2:3306 check | |
backend static | |
mode http | |
balance roundrobin | |
server ngnix1 10.10.10.1:80 check inter 60s rise 5 fall 2 | |
server ngnix2 10.10.10.2:80 check inter 60s rise 5 fall 2 | |
server ngnix3 10.10.10.3:80 check inter 60s rise 5 fall 2 | |
server ngnix4 10.10.10.4:80 check inter 60s rise 5 fall 2 | |
server ngnix5 10.10.10.5:80 check inter 60s rise 5 fall 2 | |
server ngnix6 10.10.10.6:80 check inter 60s rise 5 fall 2 | |
server ngnix7 10.10.10.7:80 check inter 60s rise 5 fall 2 | |
server ngnix8 10.10.10.8:80 check inter 60s rise 5 fall 2 | |
server ngnix9 10.10.10.9:80 check inter 60s rise 5 fall 2 | |
server ngnix10 10.10.10.10:80 check inter 60s rise 5 fall 2 | |
backend mobile | |
mode http | |
balance leastconn | |
monitor-uri /mobile_app_check | |
server mobile1 10.10.20.1:80 check inter 60s rise 5 fall 2 | |
server mobile2 10.10.20.2:80 check inter 60s rise 5 fall 2 | |
server mobile3 10.10.20.3:80 check inter 60s rise 5 fall 2 | |
server mobile4 10.10.20.4:80 check inter 60s rise 5 fall 2 | |
server mobile5 10.10.20.5:80 check inter 60s rise 5 fall 2 | |
server mobile6 10.10.20.6:80 check inter 60s rise 5 fall 2 | |
server mobile7 10.10.20.7:80 check inter 60s rise 5 fall 2 | |
server mobile8 10.10.20.8:80 check inter 60s rise 5 fall 2 | |
server mobile9 10.10.20.9:80 check inter 60s rise 5 fall 2 | |
server mobile10 10.10.20.10:80 check inter 60s rise 5 fall 2 | |
server mobile11 10.10.20.11:80 check inter 60s rise 5 fall 2 | |
server mobile12 10.10.20.12:80 check inter 60s rise 5 fall 2 | |
server mobile13 10.10.20.13:80 check inter 60s rise 5 fall 2 | |
server mobile14 10.10.20.14:80 check inter 60s rise 5 fall 2 | |
server mobile15 10.10.20.15:80 check inter 60s rise 5 fall 2 | |
server mobile16 10.10.20.16:80 check inter 60s rise 5 fall 2 | |
server mobile17 10.10.20.17:80 check inter 60s rise 5 fall 2 | |
server mobile18 10.10.20.18:80 check inter 60s rise 5 fall 2 | |
server mobile19 10.10.20.19:80 check inter 60s rise 5 fall 2 | |
server mobile20 10.10.20.20:80 check inter 60s rise 5 fall 2 | |
backend api | |
mode http | |
balance leastconn | |
monitor-uri /api_app_check | |
server api1 10.10.30.1:80 check inter 60s rise 5 fall 2 | |
server api2 10.10.30.2:80 check inter 60s rise 5 fall 2 | |
server api3 10.10.30.3:80 check inter 60s rise 5 fall 2 | |
server api4 10.10.30.4:80 check inter 60s rise 5 fall 2 | |
server api5 10.10.30.5:80 check inter 60s rise 5 fall 2 | |
server api6 10.10.30.6:80 check inter 60s rise 5 fall 2 | |
server api7 10.10.30.7:80 check inter 60s rise 5 fall 2 | |
server api8 10.10.30.8:80 check inter 60s rise 5 fall 2 | |
server api9 10.10.30.9:80 check inter 60s rise 5 fall 2 | |
server api11 10.10.30.11:80 check inter 60s rise 5 fall 2 | |
server api12 10.10.30.12:80 check inter 60s rise 5 fall 2 | |
server api13 10.10.30.13:80 check inter 60s rise 5 fall 2 | |
server api14 10.10.30.14:80 check inter 60s rise 5 fall 2 | |
server api15 10.10.30.15:80 check inter 60s rise 5 fall 2 | |
server api16 10.10.30.16:80 check inter 60s rise 5 fall 2 | |
server api17 10.10.30.17:80 check inter 60s rise 5 fall 2 | |
server api18 10.10.30.18:80 check inter 60s rise 5 fall 2 | |
server api19 10.10.30.19:80 check inter 60s rise 5 fall 2 | |
server api20 10.10.30.20:80 check inter 60s rise 5 fall 2 | |
backend blog | |
mode http | |
balance roundrobin | |
server blogs1 10.10.40.1:80 check inter 60s rise 5 fall 2 | |
server blogs2 10.10.40.1:80 check inter 60s rise 5 fall 2 | |
server blogs3 10.10.40.1:80 check inter 60s rise 5 fall 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment