- Requirements Description
Server Description:
HAProxy server:192.168.1.90
web1:192.168.1.103
web2:192.168.1.105
Domain:tecadmin.net
When the user accesses the: Tecadmin.net/blog link, it only jumps to the WEB2 (192.168.1.105) server.
All other accesses will be redirected to the WEB1 or WEB2 server based on the weights.
- Configuration file
Global Log127.0.0.1local0 Notice Maxconn50000daemondefaults Log global mode HTTP option httplog option Dontlognull contimeout120000Clitimeout120000Srvtimeout120000option forwardfor option HTTP-server-close# Configuration forhttp Sitefrontend http-inchBind192.168.1.90: theACL Is_blog Url_beg/Blog Use_backend tecadmin_blogifis_blog default_backend tecadmin_websitebackend tecadmin_blog mode http Balance Roundrobin # Load balancing Algorithm option httpchk option forwardfor Server WEB2192.168.1.105: theWeight1Maxconn +checkbackend tecadmin_website mode http Balance roundrobin # Load balancing algorithm option Httpchk opt Ion Forwardfor Server WEB1192.168.1.103: theWeight1Maxconn +Check server WEB2192.168.1.105: theWeight1Maxconn +Check
Haproxy Code
- Reference Link: http://tecadmin.net/haproxy-acl-for-load-balancing-on-url-request/
Haproxy configuring ACLs to handle different URL requests