docker容器启动haproxy

1、在本地新增haproxy.cfg文件(本次haproxy.cfg文件路径为/root/haproxy.cfg),内容如下:

#----------------
# Global settings
#----------------
global
log 127.0.0.1 local2
maxconn
daemon
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/
option redispatch
retries
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn
#-------------
#Stats monitor
#-------------
frontend stats_monitor
bind *:
stats enable
stats uri /stats
stats auth admin:admin
stats admin if TRUE
stats refresh 5s
stats realm baison-test-Haproxy
# stats hide-version
#--------------------
#Application frontend
#--------------------
frontend GEOGLOBE
bind *:
#ACL#
acl map_acl path_reg -i /map/
#USE_BACKEND#
use_backend map_backend if map_acl
#map_begin#
backend map_backend
balance roundrobin
mode http
server map_101 172.15.103.195: check weight
#map_end#

2、使用Docker run启动容器

docker run -d -p  -p  --name haproxy -v /root/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro haproxy:1.9.11
上一篇:jquery动态生成的元素添加事件的方法


下一篇:IIS问题汇总