HAProxyconfiguration

在我能find的所有用例中,HAProxy运行在与内容服务器不同的服务器上,例如:

实例1 – 负载均衡器主机名:haproxy IP:192.168.205.15

实例2 – Web服务器1主机名:webser01 IP:192.168.205.16

实例2 – Web服务器2主机名:webserver02 IP:192.168.205.17

是否有可能在内容服务器上运行HAProxy(和nginx一起)以及configuration如何?

configuration与在单个节点上的configuration相同。

最小configuration可以是:

frontend www-http bind *:80 default_backend apache backend apache mode http balance roundrobin server web1 10.0.0.1:8080 server web2 10.0.0.2:8080 

问题是冗余。 只有一个haproxy你没有高可用性。 Web服务器上的HAProxy + keepalived可能是一个解决scheme…