JackTheKnife
JackTheKnife

Reputation: 4144

Flask app on Nginx time out after 1 minute

I'm trying to serve Flask app on Nginx (first time with Nginx for Flask) via uWSGI.

Nginx config looks like:

server {

    listen 80;

    location / {
        include uwsgi_params;
        uwsgi_pass flask:5555;
    }

    client_max_body_size 100M;

    client_header_timeout 120s;
    client_body_timeout 120s;
    keepalive_timeout 120s;
    send_timeout 120s;
}

and uWSGI

wsgi-file = run.py
callable = app
socket = :5555
processes = 4
threads = 2
master = true
chmod-socket = 660
vacuum = true
die-on-term = true

but Flask app with larger payload to it will Time Out on the Nginx side after 1 minute no matter what.

Flask app, when running from the terminal, works fine.

Any tips on that?

Upvotes: 2

Views: 1082

Answers (1)

JackTheKnife
JackTheKnife

Reputation: 4144

Solved it adding timeout to the uWSGI in the nginx.conf as

server {

    listen 80;

    location / {
        include uwsgi_params;
        uwsgi_pass flask:5555;
        uwsgi_read_timeout 300;
    }

    client_max_body_size 100M;

    client_header_timeout       120s;
    client_body_timeout         120s;
    keepalive_timeout           120s;
    send_timeout                120s;
}

Upvotes: 2

Related Questions