Nginx + UWSGI + Flask 504网关超时错误

时间:2020-06-22 18:35:33

标签: python nginx flask uwsgi

我的nginx + uwsgi有问题,正好在调用Flask Rest API后60秒后收到504错误的网关错误。以下是一些Nginx配置的内容。我是否缺少某些内容或需要对配置文件进行任何更改

/etc/nginx/conf.d/nginx.conf 内容

server {
    listen 6611;
    #ssl_certificate /cert/host.pem;
    #ssl_certificate_key /cert/host.key;
    underscores_in_headers on;
    location / {
        try_files $uri @app;
        proxy_send_timeout 3000;
        proxy_connect_timeout 3000;
        proxy_read_timeout 3000;
        uwsgi_read_timeout 3000;
        uwsgi_connect_timeout 3000;
        uwsgi_send_timeout 3000;
        client_body_timeout 3000;
    }
    location @app {
        include uwsgi_params;  
        uwsgi_pass unix:///tmp/uwsgi.sock;
    }
    error_log /var/log/nginx/test.dev.error.log;
    access_log /var/log/nginx/test.dev.access.log;
    location /static {
        alias /static;
    }
}

/etc/nginx/nginx.conf 内容

worker_processes 5;
error_log  /var/log/nginx/error.log warn;
pid        /tmp/nginx.pid;
events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
#    include       /etc/nginx/proxy.conf;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    keepalive_timeout  65;
    #gzip  on;
    include /etc/nginx/conf.d/*.conf;
    proxy_temp_path /tmp/proxy_temp;
    client_body_temp_path /tmp/client_temp;
    fastcgi_temp_path /tmp/fastcgi_temp;
    uwsgi_temp_path /tmp/uwsgi_temp;
    scgi_temp_path /tmp/scgi_temp;
}
daemon off;

预先感谢

0 个答案:

没有答案