Haproxy Handle Multiple Domain and SSL

阅读更多
Haproxy Handle Multiple Domain and SSL

global
    maxconn     400

defaults
    mode     http
    timeout connect         30000
    timeout client          50000
    timeout server          50000

    stats enable
    stats hide-version
    stats uri     /stats
    stats auth    admin:admin

frontend webapp
    bind *:80
    bind *:443 ssl crt /tool/haproxy-1.8.14/conf/sillycatname.pem crt /tool/haproxy-1.8.14/conf/kikokangname.pem
   
    acl host_sillycat hdr_dom(host) -i sillycat111.ddns.net
    acl host_kikokang hdr_dom(host) -i kikokang111.ddns.net

    redirect scheme https if !{ ssl_fc }
    use_backend grav-web if host_sillycat
    use_backend flarum-web if host_kikokang

backend grav-web
    balance roundrobin
    option httpclose
    option forwardfor

    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }

    server grav-web1 192.168.1.108:8081 cookie A check

backend flarum-web
    balance roundrobin
    option httpclose
    option forwardfor

    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }

    server static-web1 192.168.1.108:8082 cookie A check

listen scrapyd
    bind     *:6800      
    mode    tcp     
    balance roundrobin      
    server  scrapyd1  xxxxxxxxx:6801 check
    server  scrapyd2  xxxxxxxxx:6802 check



References:
https://gist.github.com/urodoz/d7796cec6d47566439ba3d8ecce962f1

你可能感兴趣的:(Haproxy Handle Multiple Domain and SSL)