我在烧瓶上创建了一个端点,该端点从数据库查询(远程数据库)生成电子表格,然后将其作为下载内容发送到浏览器中。Flask不会抛出任何错误。Uwsgi没有抱怨。
但是当我检查nginx的error.log时,我看到了很多
2014/12/10 05:06:24 [错误] 14084#0:* 239436上游过早关闭连接,同时从上游读取响应头,客户端:34.34.34.34,服务器:me.com,请求:“ GET / download / export .csv HTTP / 1.1”,上游:“ uwsgi://0.0.0.0:5002”,主机:“ me.com”,引荐来源网址:“ https://me.com/download/export.csv ”
我像部署uwsgi
uwsgi --socket 0.0.0.0:5002 --buffer-size=32768 --module server --callab app
我的nginx配置:
server { listen 80; merge_slashes off; server_name me.com www.me.cpm; location / { try_files $uri @app; } location @app { include uwsgi_params; uwsgi_pass 0.0.0.0:5002; uwsgi_buffer_size 32k; uwsgi_buffers 8 32k; uwsgi_busy_buffers_size 32k; } } server { listen 443; merge_slashes off; server_name me.com www.me.com; location / { try_files $uri @app; } location @app { include uwsgi_params; uwsgi_pass 0.0.0.0:5002; uwsgi_buffer_size 32k; uwsgi_buffers 8 32k; uwsgi_busy_buffers_size 32k; } }
这是nginx或uwsgi问题,还是两者都有?
更改nginx.conf以包括
sendfile on; client_max_body_size 20M; keepalive_timeout 0;