最近,我使用django, uwsgi和nginx构建一个简单的网站,我发现uwsgi进程会在nginx[nginx.conf] upstream指令的配置中做两次请求。这里是我的nginx.conf:
==========================================
user root;
worker_processes 5;
error_log logs/error.log error;
pid logs/ssh-nginx.pid;
events {
use epoll;
worker_connections 40480;
accept_mutex off;
}
http {
uwsgi_connect_timeout 15;
uwsgi_send_timeout 8;
uwsgi_read_timeout 8;
upstream mysite_stream {
server unix:/var/run/test.socket;
server 127.0.0.1:9002 backup;
}
server {
listen 80;
server_name www.mysite.cn;
location / {
include uwsgi_params;
uwsgi_pass mysite_stream;
}
}
}
============================================
如果在测试中请求超时。套接字8秒后,请求将传递到备份流。我只是希望nginx响应超时504到浏览器,不希望它做两次请求。有人能帮帮我吗?
我添加了uwsgi_next_upstream error来解决这个问题