nginx 负载均衡配置
2021-03-29 本文已影响0人
炒面Z
server {
.........
location /admin-api{
rewrite ^/admin-api/(.*)$ /$1 break;
client_max_body_size 20M;
proxy_read_timeout 40; # 秒
proxy_pass http://admin-api;
proxy_cookie_path / /admin-api;
proxy_set_header Host $host;
add_header Nginx-Res "http://admin-api";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
# admin-api 负载均衡
upstream admin-api{
server IP1:PORT weight=1;
server IP2:PORT weight=1;
}