haproxy配置https

https://github.com/haproxy/haproxy

haproxy没有Windows版本,需要自己编译

链接:https://pan.baidu.com/s/1uvKbxKK6-DeG_g_KAJ4IZw?pwd=74r7
提取码:74r7

主要配置示例:

global
    log 127.0.0.1 local0
    chroot E:/haproxy2.4.0
    daemon
    quiet
    nbproc 4
    pidfile E:/haproxy2.4.0/haproxy.pid

defaults
    log global
    mode http
    option httplog
    option httpclose
    option dontlognull
    option forwardfor
    option redispatch
    retries 2
    maxconn 2000
    balance leastconn
    timeout client 1m
    timeout server 1m
    timeout connect 10s
	
listen stats
    bind *:8888
    stats uri /haproxy-stats
    stats realm Haproxy\ statistic
    stats auth admin:admin

frontend portal_http_frontend
    acl is_http hdr_beg(host) weixin.ahjtxx.com
    bind *:443 ssl crt E:/haproxy2.4.0/ssl/server.pem
    http-request redirect scheme https code 301 if !{ ssl_fc }
    use_backend portal if is_http           

backend portal
    server www1 218.22.27.76:80 cookie server01 weight 5 check inter 2000 rise 2 fall 5
posted @ 2023-03-19 17:32  #码农9527#  阅读(17)  评论(0)    收藏  举报