frontend web_service
bind *:80
mode http
log global
option httplog
option httpclose
option forwardfor
acl inside_src path_beg -i /inside
use_backend inside_servers if inside_src
default_backend external_servers
backend external_servers
mode http
balance roundrobin
option httpchk GET /index.html
server web1 192.168.32.75:8080 cookie web1 check inter 2000 rise 2 fall 3 weight 1
server web2 192.168.32.74:80 cookie web2 check inter 2000 rise 2 fall 3 weight 1
backend inside_servers
mode http
balance roundrobin
server web3 192.168.32.73:80 check inter 1500 rise 3 fall 3
haproxy 80跳转80:
192.168.32.73 上的配置:
demo:/root# cat /etc/httpd/conf/httpd.conf | grep 80
#Listen 12.34.56.78:80
Listen 80
demo:/root# cat /etc/httpd/conf/httpd.conf | grep html
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# (available at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
如果haproxy 需要通过/inside 访问, 那么192.168.32.73上需要建立inside目录
demo:/var/www/html/inside# pwd
/var/www/html/inside
demo:/var/www/html/inside# ls
index.html