告诉Nginx在出现错误时尝试另一个上游
我试图确定,当第一个选择的服务器返回特定错误时,是否可以告诉Nginx为指定的上游选择另一个服务器 例如:告诉Nginx在出现错误时尝试另一个上游,nginx,load-balancing,Nginx,Load Balancing,我试图确定,当第一个选择的服务器返回特定错误时,是否可以告诉Nginx为指定的上游选择另一个服务器 例如: 这是你需要做的一个例子,你可以阅读更多的细节 Thx Mohammad,这与proxy_next_上游指令相结合完成了这项工作。 try upstream server 0 if it returns a certain error code (eg: 503) try upstream 1 else return response to client upstream
这是你需要做的一个例子,你可以阅读更多的细节
Thx Mohammad,这与proxy_next_上游指令相结合完成了这项工作。
try upstream server 0
if it returns a certain error code (eg: 503)
try upstream 1
else
return response to client
upstream myservers{
#the first server is the main server
server xxx.xxx.xxx.xxx weight=999 fail_timeout=5s max_fails=1;
server xxx.xxx.xxx.xxx;
}
server {
# all config
proxy_pass http://myservers;
}