实验环境
192.168.186.129 centos7 安装nginx的负载均衡器
192.168.186.128 centos7 提供真实服务的httpd服务器
192.168.186.130 centos7 提供真实服务的httpd服务器
本地windows
关闭防火墙和selinux
systemctl stop firewalld |
httpd服务器配置
yum install httpd -y |
nginx负载均衡器配置
upstream myserver { |
测试
windows端浏览器输入192.168.186.129:80看是否能正常轮询切换到web1、web2
问题
如果出现返回页面报400错误,有可能是invalid hostname,也可能是其他http header导致服务器端无法正常解析。