uwsgi在1分钟后返回500个错误

2024-10-04 01:33:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经设置了一个nginx+uwsgi+flask应用程序,它的工作原理很不错,但是如果我加载一个页面并在1分钟后加载其他页面(或同一个页面),uwsgi返回一个500内部服务器错误,日志中没有任何信息,如果我加载页面,它可以正常工作。在

我注意到只有当请求绑定到上一个进程的同一个pid时才会发生这种情况。在

这是我用来启动uwsgi的:

HOSTPATH=/var/www/vhosts/example.com

uwsgi -H $HOSTPATH/httpdocs/venv -x $HOSTPATH/httpdocs/uwsgi.xml -M 4 -t 30 -A 4 -p 4  --pidfile /var/run/uwsgi.pid -d /var/log/uwsgi.log --harakiri-verbose --enable-threads --log-5xx --no-orphans

我的uwsgi.xml文件以下内容:

^{pr2}$

以及我的nginx conf:

server {
    listen 80;
    listen xx.xxx.xxx.xx:80 default_server;

    server_name example.com;
    client_max_body_size 128m;

    location / {
        include         uwsgi_params;
        uwsgi_pass      127.0.0.1:3031;
        proxy_set_header X-Accel-Internal /static;
    }


    location /static {
        alias      /var/www/vhosts/example.com/httpdocs/app/project/static/;
    }
}

有什么想法吗?在


Tags: comlogserverexamplevarwwwnginxstatic
2条回答

我安装了NewRelic,发现错误是MySQL超时。在

你确定uWSGI会返还500美元,nginx不会这么做吗?你能启用烧瓶调试吗?在

你查过那页了吗:http://uwsgi-docs.readthedocs.org/en/latest/ThingsToKnow.html

出于好奇,是否有任何特定的原因将xml配置与命令行参数混合使用?在

相关问题 更多 >