我们有一个负载均衡器,后面有3个成员:
主负载均衡器:www.website.com 成员:web1.website.com、web2.website.com和web3.website.com
目前我们在负载均衡器上使用的是nginx,但我们想用HAProxy替换它。
Nginx使用以下行将没有www的域名(domain.com)重写为www.domain.com:
server {
server_name domain.com;
listen 1.2.3.4:80;
rewrite ^(.*) http://www.domain.com$1 permanent;
}
我该如何使用HAproxy进行管理?
我的haproxy配置:
frontend http 1.2.3.4:80
default_backend www_cluster
acl is_www hdr_end(host) -i www.domain.com
use_backend www_cluster if is_www
backend www_cluster
balance roundrobin
cookie SERVERID insert nocache indirect
option httpchk HEAD / HTTP/1.0
option httpclose
option forwardfor
server web1 1.2.3.5:82 cookie WEB1 check
server web2 1.2.3.6:82 cookie WEB2 check
server web3 1.2.3.7:82 cookie WEB3 check
谢谢!
index.php
的URL? - Nullpointer