haproxy 配置文件詳解 之 配置文件示例


此示例文件在haproxy1.8.20 測試沒有問題:

global
    log 127.0.0.1 local0 info
    maxconn 4096
    user nobody
    group nobody
    daemon
    nbproc 1
    pidfile /usr/local/haproxy/logs/haproxy.pid

defaults
    mode http
    retries 3
    timeout connect 10s
    timeout client 20s
    timeout server 30s
    timeout check 5s

frontend www
    bind *:80
    mode http
    option httplog
    option forwardfor
    option httpclose
    log global
    #acl host_www hdr_dom(host) -i www.zb.com
    #acl host_img hdr_dom(host) -i img.zb.com
    #use_backend htmpool if host_www
    #use_backend imgpool if host_img
    default_backend htmpool

backend htmpool
    mode http
    option redispatch
    option abortonclose
    balance static-rr
    cookie SESSION_COOKIE insert indirect nocache
    option httpchk GET /index.jsp
    server 237server 192.168.81.237:8080 cookie server1 weight 6 check inter 2000 rise 2 fall 3
    server iivey234 192.168.81.234:8080 cookie server2 weight 3 check inter 2000 rise 2 fall 3

backend imgpool
    mode http
    option redispatch
    option abortonclose
    balance static-rr
    cookie SERVERID
    option httpchk GET /index.jsp
    server host236 192.168.81.236:8080 cookie server1 weight 6 check inter 2000 rise 2 fall 3

listen admin_stats
    bind 0.0.0.0:9188
    mode http
    log 127.0.0.1 local0 err
    stats refresh 30s
    stats uri /haproxy-status
    stats realm welcome login\ Haproxy
    stats auth admin:admin~!@
    stats hide-version
    stats admin if TRUE

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM