nginx - 为什么在 nginx 上上传大文件失败?
问题描述
我有一个 140MB 的文件无法在我的 nginx 上上传。
我在nginx.conf
“服务器{}”块中设置了以下指令。
send_timeout 30m;
proxy_read_timeout 30m;
client_max_body_size 10g;
keepalive_timeout 0;
lingering_timeout 3m;
正在上传较小的文件。当我打开调试日志时,我在最后几条语句中看到了这些行:
[debug] 5291#0: epoll timer: -1
[debug] 4714#0: child: 3 5292 e:0 t:0 d:0 r:1 j:0
[debug] 4714#0: sigsuspend
[debug] 5292#0: epoll: fd:15 ev:0001 d:00007F9F294E72C8
[debug] 5292#0: channel: 32
[debug] 5292#0: channel command: 2
[debug] 5292#0: close channel s:0 pid:4990 our:4990 fd:10
[debug] 5292#0: channel: 32
[debug] 5292#0: channel command: 2
[debug] 5292#0: close channel s:1 pid:4991 our:4991 fd:12
[debug] 5292#0: channel: -2
[debug] 5292#0: timer delta: 141
[debug] 5292#0: worker cycle
[debug] 5292#0: epoll timer: -1
[debug] 5292#0: worker cycle
[debug] 5292#0: epoll timer: -1
解决方案
修复是设置这个指令:
http2_recv_timeout 3m;
我的客户端连接很慢,这就是文件没有上传到服务器的原因。我正在使用 nginx 版本 1.22.2
推荐阅读
- python-3.x - 如何在 Tensorflow 2 中使用 GradientTape 和 AutoGraph?
- excel - 我正在尝试汇总来自用户表单的输入
- javascript - 如何在 React 中一键提交多个 post 请求?
- font-awesome - 如何将 Font Awesome Pro 与 NativeBase 的图标一起使用?
- c# - 在 C# 中获取 HttpInputStream
- excel - 根据从下拉列表中从“A2”中选择的内容显示“B2”的内容
- c# - VS 2019 使用 MSBuild.exe 和 VSTest.console.exe 自动构建和测试
- c# - 在 SignalR Core 断开事件中等待几秒钟而不阻塞应用程序存在
- macos - 有没有办法在 Mac 上的 IDE 中进行预测输入?类似于 Google 的 Smart Compose
- python - 未提供 API 定义 - Swagger 通过 Flask/python 未加载 API/Swagger UI