haproxy ssl配置

7 篇文章 0 订阅
5 篇文章 0 订阅
一、使用tcp监控端口
frontend https_443_in
    bind 0.0.0.0:443
    mode tcp
    option tcplog 

    acl test_host hdr(host) -i www.test.com
    use_backend logic-https if test_host

backend logic-https
    mode tcp
    balance roundrobin
    server logic-01 172.31.1.2:443 check inter 2000 rise 3 fall 3 weight 1
    server logic-02 172.31.1.3:443 check inter 2000 rise 3 fall 3 weight 1
二、使用https监控端口
frontend https
    bind *:443 ssl crt /etc/ssl/haproxy-certs/www.test.com.pem crt /etc/ssl/haproxy-certs/www.test.cn.pem
    mode http
    reqadd X-Forwarded-Proto:\ https
    option httpclose
    option forwardfor  
    option http-server-close
    capture request header Host len 255
    capture request header User-Agent len 255
    capture request header Referer len 255
    capture request header Cookie len 255

    acl test_host hdr(host) -i www.test.com www.test.cn
    use_backend logic-http if test_host

backend logic-http 
    balance roundrobin
    cookie SERVERID
    server logic-01 172.31.1.2:80 check inter 2000 rise 3 fall 3 weight 1
    server logic-02 172.31.1.3:80 check inter 2000 rise 3 fall 3 weight 1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值