小编Bos*_*sky的帖子

如何使用 HAProxy 根据主机名转移流量?

我在 HAProxy 设置了一堆侦听其他各种端口的应用程序服务器方面取得了一些初步成功。

我现在有另一个网络服务器在一个端口上侦听,我想对我的配置进行哪些更改以按主机名传输流量。

以下是当前设置,假设:

  • 我的 apache 网络服务器在 examplecom:8001 上运行
  • 我的一堆应用服务器 0.0.0.0:8081, 0.0.0.0:8082 , 0.0.0.0:8083
global
  log 127.0.0.1 local0
  log 127.0.0.1 local1 notice
  maxconn 4096
  debug
  #quiet
  #user haproxy
  #group haproxy

defaults
  log global
  mode  http
  option  httplog
  option  dontlognull
  retries 3
  redispatch
  maxconn 2000
  contimeout  5000
  clitimeout  50000
  srvtimeout  50000

listen appservers 0.0.0.0:80
  mode http
  balance roundrobin
  option httpclose
  option forwardfor
  #option httpchk HEAD /check.txt HTTP/1.0
  server  inst1 0.0.0.0:8081 cookie server01 check inter 2000 fall  3
  server  inst2 0.0.0.0:8082 …
Run Code Online (Sandbox Code Playgroud)

ubuntu proxy load-balancing hostname haproxy

18
推荐指数
1
解决办法
3万
查看次数

标签 统计

haproxy ×1

hostname ×1

load-balancing ×1

proxy ×1

ubuntu ×1