我用vmware+centos做了3个虚拟机,用nginx做负载均衡。
分别是192.168.8.128,192.168.8.129,192.168.8.130
3台虚拟机上都安装了nginx
192.168.8.128 作为代理服务器
192.168.8.129,192.168.8.130 这2台服务器提供的内容都是只有一个静态的index.html文件
单独访问这2台服务器都可以打开
如果代理服务器配置修改成proxy_pass http://192.168.8.129:80; 访问192.168.8.128会显示http://192.168.8.129下的网页内容
但是代理服务器如果用upstream,配置文件如下:
upstream proxy_servers
{
server 192.168.8.129:80;
server 192.168.8.130:80;
}
server
{
listen 80;
server_name localhost;
index index.html;
location / {
proxy_pass http://proxy_servers;
}
}
访问192.168.8.128总是502错误。日志都是:
upstream prematurely closed connection while reading response header from upstream
或:
no live upstreams while connecting to upstream
selinux 和防火墙都关闭了。
不知道怎么解决问题
no live upstreams while connecting to upstream
最新推荐文章于 2023-09-24 15:30:05 发布