HAproxy 无法在多个站点上运行

HAproxy 无法在多个站点上运行

我正在尝试将单个 HAproxy Loadbalancer 用于多个站点,但只有一个站点可供我使用cp_nodes,当我尝试访问第二个网站时,它只会重定向到第一个网站。

global
   log /dev/log local0
   log /dev/log local1 notice
   chroot /var/lib/haproxy
   stats socket /run/haproxy/admin.sock mode 660 level admin
   stats timeout 30s
   user haproxy
   group haproxy
   daemon

defaults
   log global
   mode http
   option httplog
   option dontlognull
   timeout connect 5000
   timeout client 50000
   timeout server 50000

#Application Setup
frontend http_front
  bind *:80
  #redirect scheme https if !{ ssl_fc }
  stats uri /haproxy?stats
  acl cp_domains hdr(host) -i cloud.one.net
  acl admin_doamins hdr(host) -i cloud.two.net
  use_backend cp_nodes if cp_domains
  use_backend admin_nodes if admin_doamins # Not working, redirects to cp_nodes onlye 


frontend https_front
  bind *:443 ssl crt /etc/pki/cloud.pem
  stats uri /haproxy?stats
  acl cp_domains hdr(host) -i cloud.one.net
  acl admin_doamins hdr(host) -i cloud.two.net
  use_backend cp_nodes if cp_domains
  use_backend admin_nodes if admin_doamins

backend cp_nodes
  balance roundrobin
  server siteone.net 18.24.162.155:443 ssl check verify none
  server sitetwo.net 18.24.162.142:443 ssl check verify none

backend admin_nodes
  balance roundrobin
  server siteone.net:8081 18.24.162.155:8081
  server sitetwo.net:8081 18.24.162.142:8081

日志档案

Dec 27 07:37:07 lb1 haproxy[21927]: Proxy http_front started.
Dec 27 07:37:07 lb1 haproxy[21927]: Proxy https_front started.
Dec 27 07:37:07 lb1 haproxy[21927]: Proxy cp_nodes started.
Dec 27 07:37:07 lb1 haproxy[21927]: Proxy admin_nodes started.

相关内容