# cd /usr/local/haproxy
# vi haproxy.cfg
global
maxconn 51200
chroot /usr/local/haproxy
uid 99
gid 99
daemon
#quiet
nbproc 1
pidfile /usr/local/haproxy/logs/haproxy.pid
defaults
mode http
#retries 2
option redispatch
option abortonclose
timeout connect 5000ms
timeout client 30000ms
timeout server 30000ms
#timeout check 2000
log 127.0.0.1 local0 err #[err warning info debug]
balance roundrobin
# option httplog
# option httpclose
# option dontlognull
# option forwardfor
listen admin_stats
bind 0.0.0.0:8888
option httplog
stats refresh 30s
stats uri /stats
stats realm Haproxy Manager
stats auth admin:admin
#stats hide-version
listen test1
bind :12345
mode tcp
server t1 127.0.0.1:8881
server t2 192.168.1.102:8881
listen test2 :80
option httpclose
option forwardfor
server s1 127.0.0.1:8081 check weight 1 minconn 1 maxconn 3 check inter 40000
server s2 127.0.0.1:8082 check weight 1 minconn 1 maxconn 3 check inter 40000