我用 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 求助!