upstream webservers{
server 192.168.33.11 weight=10 max_fails=2 fail_timeout=30s;
server 192.168.33.12 weight=10 max_fails=2 fail_timeout=30s;
server 192.168.33.13 weight=10 max_fails=2 fail_timeout=30s;
}
server {
listen 80;
server_name upstream.iyangyi.com;
access_log /usr/local/var/log/nginx/upstream.iyangyi.access.log main;
error_log /usr/local/var/log/nginx/upstream.iyangyi.error.log error;
location / {
proxy_pass http://webservers;
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_connect_timeout
1
;
proxy_read_timeout
1
;
若给某一台服务器转发请求时,达到默认超时时间未响应,则再向另一台服务器转发请求。
默认超时时间1分钟。
proxy_send_timeout
1
;
}
}
nginx 负载均衡
最新推荐文章于 2022-05-12 13:54:42 发布