我已经设置了一个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:
<uwsgi>
<socket>127.0.0.1:3031</socket>
<chdir>/var/www/vhosts/example.com/httpdocs/app</chdir>
<pythonpath>..</pythonpath>
<module>wsgi:app</module>
<master>True</master>
</uwsgi>
我的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/;
}
}
关于它可能是什么的任何想法?
答案 0 :(得分:0)
你确定uWSGI正在返回500并且不是nginx这样做吗?你能启用烧瓶调试吗?
您是否检查过该页面:http://uwsgi-docs.readthedocs.org/en/latest/ThingsToKnow.html
只是出于好奇,有没有具体的理由将xml配置与命令行args混合使用?
答案 1 :(得分:0)
我安装了NewRelic,并发现错误是MySQL超时。