测试访问
测试haproxy反向代理web服务器:
编辑本机hosts文件,将myapp.web.com解析到对应的IP负载IP:
C:\Windows\System32\drivers\etc\hosts
192.168.7.100 myapp.web.com
记录HAProxy访问日志:
vim /etc/rsyslog.conf:
14 # Provides UDP syslog reception
15 $ModLoad imudp #去掉注释
16 $UDPServerRun 514 #去掉注释
18 # Provides TCP syslog reception
19 $ModLoad imtcp #去掉注释
20 $InputTCPServerRun 514 #去掉注释
93 local3.* /var/log/haproxy.log
systemctl restart rsyslog
log 127.0.0.1 local3 info #global部分
listen web_port
bind 0.0.0.0:80
mode http
log global
option httplog
server 192.168.7.103 192.168.7.103:8080 check inter 3000 fall 2 rise 5
server 192.168.7.104 192.168.7.104:8080 check inter 3000 fall 2 rise 5