nginx和uwsgi非常大的文件上传(> 3Gb) [英] nginx and uwsgi very large files upload (>3Gb)

查看:472
本文介绍了nginx和uwsgi非常大的文件上传(> 3Gb)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许有人知道该怎么办.我正在尝试上传大于3Gb的文件.没问题,如果我使用下一个配置上传的文件最大为2Gb:

maybe someone know what to do. I'm trying to upload files greater than 3Gb. No problems, if I upload files up to 2Gb with next configs:

Nginx:

client_max_body_size 5g;
client_body_in_file_only clean;
client_body_buffer_size 256K;

proxy_read_timeout 1200;
keepalive_timeout 30;
uwsgi_read_timeout 30m;

UWSGI选项:

harakiri 60
harakiri 1800
socket-timeout 1800
chunked-input-timeout 1800
http-timeout 1800

当我上传大文件(近4Gb)时,它会上传〜2-2.2Gb并以错误停止:

When i upload big (almost 4Gb) file, it uploads ~ 2-2.2Gb and stops with error:

[uwsgi-body-read] Timeout reading 4096 bytes. Content-Length: 3763798089 consumed: 2147479552 left: 1616318537

我应该使用哪些参数?

Which params i should use?

推荐答案

最终解决我的问题的方法是设置:

What ended up solving my issue was setting:

uwsgi.ini

http-timeout = 1200
socket-timeout = 1200

nginx_site.conf

proxy_read_timeout 1200;
proxy_send_timeout 1200;
client_header_timeout 1200;
client_body_timeout 1200;
uwsgi_read_timeout 20m;

在遇到类似的大文件(> 1Gb)问题后,我从收集了更多信息github issue stackoverflow线程等.最终发生的事情是python/uwsgi花了太长时间来处理大文件,而nginx停止监听uwsgi导致504错误.因此,增加http和套接字通信的超时时间最终解决了它.

After stumbling upon a similar issue with large files (>1Gb) I collected further info from github issue and stackoverflow thread and several more. What ended up happening was python / uwsgi taking too long to process the large file, and nginx stopped listening to uwsgi leading to a 504 error. So increasing the timeout time for http and socket communication ended up resolving it.

这篇关于nginx和uwsgi非常大的文件上传(> 3Gb)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆