192.168.169.123 8081端口 代理 http://192.168.169.191
192.168.169.123 8082端口 代理 http://192.168.169.192
配置文件:
server{
listen 8081;
server_name localhost;
location /{
# root html;
# index index.html index.html iisstart.htm;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://192.168.169.191/;
}
}
server{
listen 8082;
server_name localhost;
location /{
# root html;
# index index.html index.html iisstart.htm;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://192.168.169.192/;
}
}
负载均衡配置
upstream js {
server 192.168.169.191:80 weight=1;
server 192.168.169.192:80 weight=1;
}
server{
listen 8090;
server_name js;
location / {
proxy_pass http://js;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
upstream js {
server 192.168.169.191:80 weight=1;
server 192.168.169.192:80 weight=1;
}
server{
listen 8090;
server_name js;
location / {
proxy_pass http://js;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
网页标题:nginx代理设置
URL链接:
http://njwzjz.com/article/pjdioh.html