【问题标题】:Nginx reverse proxy blocks large files to aiohttp serverNginx 反向代理阻止大文件到 aiohttp 服务器
【发布时间】:2021-07-22 14:07:44
【问题描述】:

Nginx 在应用服务器上用作对 python aiohttp Web 应用程序的所有请求的反向代理。浏览器客户端通过 nginx 将大小为 220kb 及以上的文件上传到服务器失败。在循环中没有 nginx 文件上传工作正常。上传较大文件时nginx没有响应,它只是挂起,nginx只有在杀死POST方法后才会响应。我尝试修改不同的客户端缓冲区大小和超时,但这没有帮助。 使用以下配置设置尝试了不同的选项 -> client_body_in_file_only clean;client_body_buffer_size 32K;client_max_body_size 30M;send_timeout 300s。

【问题讨论】:

    标签: nginx nginx-reverse-proxy aiohttp


    【解决方案1】:

    我没有你的设置,但这里是可以帮助你使用 aiohttp 和 NGINX 的指南。我使用 python-socketio 和 aiohttp 和 nginx:

    1. 在 web.Application() 中声明文件上传大小,这很容易错过:) web.Application(client_max_size=1024**2*30)

    2. 检查您的 NGINX 是否同时具有 HTTP 和 https 并在这两个地方声明: client_max_body_size 30M;

    是否使用 Gunicorn 无关紧要,但强烈推荐。

    希望这会有所帮助。 史蒂夫

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-07
      • 2021-10-13
      • 2017-08-16
      • 2018-09-10
      • 2017-07-17
      • 2014-07-25
      • 2020-08-19
      • 2020-06-29
      相关资源
      最近更新 更多