Haproxy 配置 ACL 处理不同的 URL 请求
[*]需求说明
服务器介绍:
HAProxy Server: 192.168.1.90
WEB1 : 192.168.1.103
WEB2 : 192.168.1.105
Domain: tecadmin.net
当用户访问:tecadmin.net/blog链接,只会跳转到WEB2(192.168.1.105)服务器.
而其他所有的访问将根据权值跳转到WEB1或者WEB2服务器
[*]配置文件
global
log 127.0.0.1 local0 notice
maxconn 50000
daemon
defaults
log global
mode http
option httplog
option dontlognull
contimeout 120000
clitimeout 120000
srvtimeout 120000
option forwardfor
option http-server-close
# Configuration for HTTP site
frontend http-in
bind 192.168.1.90:80
acl is_blog url_beg/blog
use_backend tecadmin_blog if is_blog
default_backend tecadmin_website
backend tecadmin_blog
mode http
balance roundrobin# Load Balancing algorithm
option httpchk
option forwardfor
server WEB2 192.168.1.105:80 weight 1 maxconn 512 check
backend tecadmin_website
mode http
balance roundrobin# Load Balancing algorithm
option httpchk
option forwardfor
server WEB1 192.168.1.103:80 weight 1 maxconn 512 check
server WEB2 192.168.1.105:80 weight 1 maxconn 512 check
haproxy Code
[*]参考链接:http://tecadmin.net/haproxy-acl-for-load-balancing-on-url-request/
页:
[1]