我有以下负载平衡配置:
upstream upstream {
ip_hash;
keepalive 1000;
server 10.10.10.1;
server 10.10.10.2;
server 10.10.10.3;
}
server {
listen 443;
server_name example.com;
ssl_certificate /etc/nginx/certs/cert.crt;
ssl_certificate_key /etc/nginx/certs/cert.key;
ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
location / {
client_max_body_size 80m;
proxy_http_version 1.1;
proxy_set_header Connection "";
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 X-Forwarded-Proto $scheme;
proxy_read_timeout 90;
proxy_pass http://upstream;
}
}
Run Code Online (Sandbox Code Playgroud)
虽然我的后端节点稳定,但一切正常。但是,当我关闭其中一个节点(例如 10.10.10.2)时,NGINX 将继续向其发送流量,即使请求不断超时(因为服务器已关闭)。我已经尝试设置max_fails
和fail_timeout
参数,但行为仍然相同。
NGINX 是否能够自动检测服务器是否关闭而不向那里发送流量?我缺少什么配置?
nginx ×1