upstream lucky5{
server 127.0.0.1:3000 weight=10;
server 127.0.0.1:3001 weight=5;
}
server{
location /
{
proxy_pass http://test;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header my-backendIP $upstream_addr; # 后端转发的代理服务器
add_header my-backendCode $upstream_status; # 响应状态
add_header X-Cache $upstream_cache_status; # 命中缓存
add_header Cache-Control no-cache; 不缓存
#Set Nginx Cache
# proxy_ignore_headers Set-Cookie Cache-Control expires;
# proxy_cache cache_one;
# proxy_cache_key $host$uri$is_args$args;
# proxy_cache_valid 200 304 301 302 1m;
# expires 12h;
}
}
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream