【问题标题】:HAproxy port 80 and 443 to backend:80 and backend:443HAproxy 端口 80 和 443 到后端:80 和后端:443
【发布时间】:2017-01-16 16:02:03
【问题描述】:

如何改进以下配置,让 haproxy 监听端口 80 和 443 并将请求传递给 backend:80 或 backend: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

【问题讨论】:

  • 你想“改进”什么?
  • 不确定,但我觉得必须有更好的方法来做到这一点。

标签: nginx haproxy


【解决方案1】:

在 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

【讨论】:

  • 太棒了。谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-25
  • 1970-01-01
  • 1970-01-01
  • 2019-11-12
  • 2017-06-28
  • 1970-01-01
相关资源
最近更新 更多