【发布时间】:2018-09-20 20:29:08
【问题描述】:
我正在开发 django+gunicorn+nginx。 在 django 管理员中,我试图删除一个项目“用户”,它链接到数据库中的大量数据,并在 60 秒后返回“504 网关超时”。 然后我尝试更改 nginx 的配置和 gunicorn 的配置,如下所示
在独角兽中:
timeout = 10000
在 nginx 中
proxy_connect_timeout 50000;
proxy_read_timeout 50000;
proxy_send_timeout 50000;
但是无论我做了什么改变,服务器总是在 60 秒后超时!
我能做什么?我一无所知...
而且服务器也关闭了,我什至无法 ssh 进入它。 看起来不是 nginx/gunicorn 配置问题?
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;
}
【问题讨论】:
-
制作chanes后是否重启了nginx和gunicorn?
-
是的,我还有 60 多岁的超时时间..
-
你确定你正在使用你的配置文件吗?也许尝试使用 gunicorn 手动执行您的 django 应用程序,设置
--timeout标志并检查它是否有帮助。 -
是的,我确定它正在使用配置文件,我将文件更新为不同的TIMEOUT值,然后我检查了ps -aux,gunicorn有--timeout xxx运行参数.
-
django admin 本身是否有超时机制?当查询耗时过长会返回超时...?