在配置文件vim /usr/local/nginx/conf/nginx.conf中添加以下内容。
upstream web-server{
ip_hash;
server 192.168.15.136 fail_timeout=60s weight=3;
server 192.168.15.135 weight=7;
}
server
{
listen 80;
server_name localhost;
location /{
proxy_pass http://web-server;
root html;
index index.html index.htm;
}
}
保存退出后重启nginx就可以了,访问效果。如图