找三台主机
192.168.137.10 (反向代理)
192.168.137.2 (WEB主机1)
192.168.137.3 (WEB主机2)
仅对192.168.137.10进行配置,
在/etc/nginx/nginx.conf中的http节点部分加入:
upstream 192.168.137.10 {
server 192.168.137.2:80;
server
192.168.137.3:80;
}
server
{
listen
80;
server_name
192.168.137.10;
location /
{
proxy_pass http://192.168.137.10;
proxy_set_header Host $host;
proxy_set_header X-Real-IP
$remote_addr;
proxy_set_header
X-Forwarded-For
$proxy_add_x_forwarded_for;
}
}
原文地址:http://7737197.blog.51cto.com/7727197/1664588