ZZB
ZZB

Reputation: 285

nginx uwsgi timeout

Recently, I used django, uwsgi and nginx to build a simple website, and I found that uwsgi process would do the request twice in the configure of nginx[nginx.conf] upstream directive.Here is the my 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;
        }
    }
}

============================================

If the request timeout in the test.socket after 8 seconds, then the request will pass to the backup stream.I just wanted nginx to response timeout 504 to the browser and do not want it to do the request twice.could anybody help me?

Upvotes: 2

Views: 1630

Answers (1)

ZZB
ZZB

Reputation: 285

I add uwsgi_next_upstream error to solve the problem.

Upvotes: 1

Related Questions