简体   繁体   中英

django+gunicorn+nginx, django admin return 504 Gateway Time-out

I am working on django+gunicorn+nginx. In the django admin, i am trying to delete an item 'user', which links to quite a lot of data in database, and it returns ' 504 Gateway Time-out' after 60 seconds. Then I tried on changing the config of nginx and the one of gunicorn as below

in gunicorn:

timeout = 10000

and in nginx

    proxy_connect_timeout 50000;
    proxy_read_timeout 50000;
    proxy_send_timeout 50000;

But no matter what i have changed, the server always timeout after 60 seconds!

What can i do? I am total clueless...

And also the server is down too, i can't even ssh into it. looks not a nginx/gunicorn config problem?

ngix.conf

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

sites-enabled/app.conf

    location / {
    try_files $uri @app;
}

location @app {
    proxy_connect_timeout 50000;
    proxy_read_timeout 50000;
    proxy_send_timeout 50000;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://xxx;
}

Set the timeout ngnix setings into the http{ ... } block in /etc/nginx/nginx.conf file:

http {
    #All block content...

    #Now the timeout settings:

    proxy_connect_timeout 50000;
    proxy_read_timeout 50000;
    proxy_send_timeout 50000;
}

Restart nginx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM