Nginx HAproxy端口80和443到后端:80和后端:443

Nginx HAproxy端口80和443到后端:80和后端:443,nginx,haproxy,Nginx,Haproxy,我如何改进以下配置,让haproxy监听端口80和443,并根据需要将请求传递到后端:80或后端:443 有更好的方法吗 frontend http bind 35.154.100.100:80 default_backend http_nginx_pool frontend https bind 35.154.100.100:443 default_backend https_nginx_pool backend http_nginx_pool

我如何改进以下配置,让haproxy监听端口80和443,并根据需要将请求传递到后端:80或后端:443

有更好的方法吗

frontend http
    bind    35.154.100.100:80
    default_backend http_nginx_pool

frontend https
    bind    35.154.100.100:443
    default_backend https_nginx_pool

backend http_nginx_pool
    mode tcp
    server nginx2 10.233.32.143:80 check

backend https_nginx_pool
    mode tcp
    server nginx2 10.233.32.143:443 check

在HAProxy 1.5上进行测试,效果良好

frontend http-https-in
bind    35.154.100.100:80
bind    35.154.100.100:443

use_backend http_nginx_pool    if !{ ssl_fc }
use_backend https_nginx_pool   if { ssl_fc }

backend http_nginx_pool
    mode http
    server nginx2 10.233.32.143:80 check

backend https_nginx_pool
    mode http
    server nginx2 10.233.32.143:443 check

你想“改进”什么?我不确定,但我觉得必须有更好的方法来做。太棒了。非常感谢。