HAProxy 配置文件


global
    log         127.0.0.1 local2 info
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     20480
    nbproc     8
    user        haproxy
    group       haproxy
    daemon
    stats socket /var/lib/haproxy/stats
defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    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                 3000
    stats refresh 30s
    stats realm Welcome Login Haproxy Statistics
    stats uri /haproxy-admin
    stats auth admin:admin~!@
    stats hide-version
    stats admin if TRUE

frontend  Web_Service
    bind *:80
    mode http
    log global
    option httplog
    option forwardfor
    option httpclose
    option logasap
    option dontlognull
    #capture request header Host len 20
    #copture request header Referer len 20
    default_backend             web
backend web
    mode http
    option redispatch
    option abortonclose
    balance source
    cookie SERVERID
    #option httpchk GET /index.html
    server  web1 192.168.199.203:80 cookie server1 weight 1 check inter 2000 rise 2 fall 3
    server  web2 192.168.199.204:80 cookie server2 weight 1 check inter 2000 rise 2 fall 3
 转载自:https://www.xwroot.com/archives/haproxy-%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6/
原文地址:https://www.cnblogs.com/Wang-Hongwei/p/14709897.html