我收到502 Bad Gateway错误,并意识到这可能是Gunicorn的暂停。
我正在尝试将Gunicorn的默认超时从30秒增加到更高的值,可能是5分钟,但是尽管我的配置文件发生了变化,但超时时间仍然是30秒。
我意识到第一个操作顺序是解决服务器端进程,因此不需要超过30秒。
但是,在这种情况下,我正在运行一个大型的sql存储过程报告,由于数据量很大,有时需要超过30秒。
下面是我的nginx和gunicorn配置文件。
感谢您的帮助!
gunicorn.conf:
description "Gunicorn application server handling formManagement django app"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid ubuntu
setgid www-data
chdir /home/ubuntu/AARC-ServiceManager/ServerSide/formManagement
exec ve/bin/gunicorn --timeout 300 --workers 3 --bind unix:/home/ubuntu/AARC-ServiceManager/ServerSide/formManagement/formManagement.sock formManagement.wsgi:application
nginx.conf:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
# set client body size (max http request size) #
client_max_body_size 50M;
#upping the timeouts to allow time for the DB to return from a long running sproc
proxy_connect_timeout 300s;
proxy_read_timeout 300s;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# 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/*;
}