天天看点

centos7配置haproxy

服务器列表:

haproxy服务器配置:

a. 内网配置:

cat /etc/sysconfig/network-scripts/ifcfg-eth0

centos7配置haproxy

b. 外网配置:

cat /etc/sysconfig/network-scripts/ifcfg-eth1

centos7配置haproxy

c. 安装:

yum -y install haproxy

d. 修改配置文件:

vim /etc/haproxy/haproxy.conf

centos7配置haproxy

e. 配置文件原代码:

f. 配置rsyslog:

vim /etc/rsyslog.conf,去掉如下行的注释:

centos7配置haproxy

g. 创建rsyslog的haproxy配置文件:

vim /etc/rsyslog.d/haproxy.conf,写入如下内容:

h. 重启rsyslog:

systemctl restart rsyslog

i. 启动haproxy:

systemctl start haproxy

j. 关闭apache:

systemctl stop httpd

web1服务器配置:

centos7配置haproxy

b. 关闭防火墙:

systemctl stop firewalld

web2服务器配置(参照web1):

浏览器访问(192.168.8.252):

a. 页面一:

centos7配置haproxy

b. 页面二:

centos7配置haproxy

 本文转自 Lee_吉 51CTO博客,原文链接:http://blog.51cto.com/12173069/2061851