#
# demo config for Proxy mode
#
global
maxconn 20000
# ulimit-n 20000
# ulimit-n 16384
log 127.0.0.1 local0
# log /tmp/haproxy.log
uid 200
gid 200
# chroot /var/empty
nbproc 4
daemon
frontend test-proxy
bind 0.0.0.0:81
# bind 192.168.200.10:8080
mode http
log global
option httplog
option dontlognull
option nolinger
option http_proxy
maxconn 8000
timeout client 30s
# layer3: Valid users
# acl allow_host src 192.168.200.150/32
# http-request deny if !allow_host
# layer7: prevent private network relaying
# acl forbidden_dst url_ip 192.168.0.0/24
# acl forbidden_dst url_ip 172.16.0.0/12
# acl forbidden_dst url_ip 10.0.0.0/8
# http-request deny if forbidden_dst
default_backend test-proxy-srv
backend test-proxy-srv
mode http
timeout connect 5s
timeout server 5s
retries 2
# option nolinger
option http_proxy
# layer7: Only GET method is valid
acl valid_method method GET
http-request deny if !valid_method
# layer7: protect bad reply
# http-response deny if { res.hdr(content-type) audio/mp3 }
balance roundrobin #负载均衡的方式,roundrobin平均方式
# cookie SERVERID #允许插入serverid到cookie中,serverid后面可以定义
#心跳检测的URL,HTTP/1.1¥r¥nHost:XXXX,指定了心跳检测HTTP的版本,XXX为检测时请求
#服务器的request中的域名是什么,这个在应用的检测URL对应的功能有对域名依赖的话需要设置
option httpchk GET / HTTP/1.0
#服务器定义,cookie 1表示serverid为1,check inter 1500 是检测心跳频率
#rise 3是3次正确认为服务器可用,fall 3是3次失败认为服务器不可用,weight代表权重
server mms1 127.0.0.1:6000 cookie 1 check inter 3000 rise 3 fall 3 weight 1
server mms2 127.0.0.1:6001 cookie 2 check inter 3000 rise 3 fall 3 weight 2