如果启用HAProxy状态监控,需要修改haproxy.cfg配置文件,启用stats enable
<span style="color:#2c2c2c;">listen webservers
bind *:80
</span><span style="color:#ff0000;"><strong>stats enable</strong></span><span style="color:#2c2c2c;">
frontend imgservers
bind *:8080
default_backend imgservs
backend imgservs</span>
然后重启HAProxy,在浏览器中访问172.16.2.1/haproxy?stats
![图像 034.png 202842725.png](https://i-blog.csdnimg.cn/blog_migrate/78d6fd27c742162c32a3c916c57d52ff.png)
haproxy的状态页面一般不允许别人随意查看,因此通过认证进行访问是必要的
<span style="color:#2c2c2c;">listen webservers
bind *:80
server node2.magedu.com 192.168.10.11:80 check
</span><span style="color:#ff0000;"><strong>stats enable #显示状态页面
stats hide-version #隐藏haproxy的版本号
stats realm HAProxy\ Stats #提示信息
stats auth admin:admin #登录状态页面的帐号和密码</strong></span><span style="color:#2c2c2c;">
frontend imgservers
bind *:8080
default_backend imgservs
backend imgservs</span>
![图像 036.png 203007175.png](https://i-blog.csdnimg.cn/blog_migrate/bbfbeb7088bdc514864ba7e4d71dbc80.png)