Python 使用NGINX&;服务器上的UWSGI

Python 使用NGINX&;服务器上的UWSGI,python,nginx,flask,ubuntu-18.04,uwsgi,Python,Nginx,Flask,Ubuntu 18.04,Uwsgi,我使用Flask框架开发了Python应用程序,并使用NGINX和UWSGI部署在Ubuntu18.02服务器上 服务器功能强大,可以轻松处理大量用户,但当30到40个用户连接到它时,它就开始产生问题 我检查了日志,没有发现任何应用程序错误,但在NGINX和UWSGI方面,我看到了以下错误: 来自上游的请求超时 系统未找到套接字文件未找到文件或系统未读取该文件 (套接字文件也存在于/tmp/目录中) 我无法找出问题的根本原因,是权限级别问题还是其他问题?您还可以在下面检查我的配置和ini文件:

我使用Flask框架开发了Python应用程序,并使用NGINX和UWSGI部署在Ubuntu18.02服务器上

服务器功能强大,可以轻松处理大量用户,但当30到40个用户连接到它时,它就开始产生问题

我检查了日志,没有发现任何应用程序错误,但在NGINX和UWSGI方面,我看到了以下错误:

  • 来自上游的请求超时
  • 系统未找到套接字文件未找到文件或系统未读取该文件
  • (套接字文件也存在于/tmp/目录中)

    我无法找出问题的根本原因,是权限级别问题还是其他问题?您还可以在下面检查我的配置和ini文件:

    以下是我的默认nginx和带有uwsgi.ini详细信息的mynginx配置:

    默认nginx.config

        user www-data;
        worker_processes auto;
        pid /run/nginx.pid;
        worker_rlimit_nofile 768;
        include /etc/nginx/modules-enabled/*.conf;
    
        events {
        worker_connections 768;
        multi_accept on;
        }
    
        http {
    
        ##
        # Basic Settings
        ##
    
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 650;
        send_timeout 120;
        reset_timedout_connection on;
        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;
    
        ##
        # SSL Settings
        ##
    
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;
    
        ##
        # Logging Settings
        ##
    
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
    
        ##
        # Gzip Settings
        ##
        gzip on;
    
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
    
        ##
        # Virtual Host Configs
        ##
    
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
        }
    
    mynginx.config

        user www-data;
        worker_processes auto;
        pid /run/nginx.pid;
        worker_rlimit_nofile 768;
        include /etc/nginx/modules-enabled/*.conf;
    
        events {
        worker_connections 768;
        multi_accept on;
        }
    
        http {
    
        ##
        # Basic Settings
        ##
    
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 650;
        send_timeout 120;
        reset_timedout_connection on;
        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;
    
        ##
        # SSL Settings
        ##
    
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;
    
        ##
        # Logging Settings
        ##
    
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
    
        ##
        # Gzip Settings
        ##
        gzip on;
    
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
    
        ##
        # Virtual Host Configs
        ##
    
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
        }
    
    uwsgi.ini

    任何帮助都将不胜感激,这将成为我制作应用程序的一个障碍

        [uwsgi]
        chdir = /home/tcrm/automate-prod
        module = webapp
        callable = theapp
        
        master = true
        processes = 1
        #threads = 5
        
        #http-websockets=true
        #gevent=1000
        
        #lazy-apps=true
        single-interpreter=true
        enable-threads=true
        
        socket =/tmp/automate_prod_uwsgi.sock
        #socket = 127.0.0.1:3031
        chown-socket=www-data:www-data
        chmod-socket = 666
        
        vacuum = true
        
        die-on-term = true
        
        virtualenv = /home/tcrm/.virtualenvs/automate_prod_venv/
        
        #http = 0.0.0.0:5000
        
        #stats = 0.0.0.0:5001
        #stats-http
        
        #py-autoreload = 2
        
        req-logger = file:uwsgi_request.log
        logger = file:uwsgi_webapp.log
        
        #pidfile = automate_uwsgi.pid
        #daemonize = true