Nginx:客户端请求正文被缓冲到一个临时文件

Nginx: Client request body is buffered to a temporary file

我已经在 AWS 上部署了一个 ML 模型。这是一个图像分类器。当我通过 Flask 中的表单向 ML 模型提供以下图像时,它在某些情况下有效,但在其他情况下无效。

link 作品如下:https://drive.google.com/file/d/1hbrEa2gNLdqGPJxp5jVxWcXl1wunp5Mc/view?usp=sharing

出现错误的图片link如下:https://drive.google.com/file/d/1znWTRnTMPft_r_jwpJ0JQuMnnazsUXs-/view?usp=sharing

以上两张图片看起来很像。当我 select 文件并将其上传以供分析时,第一张大约 150kb 的图像可以正常工作。然而,当我 select 并上传它以从 PC 进行分析时,图像大约为 10kb。当我尝试用我的移动 phone 浏览器执行相同操作时,两者都显示错误。

日志中显示的错误是 - [警告]:客户端请求正文缓冲到临时文件。

我按照这个 link 找到了答案:Increasing client_max_body_size in Nginx conf on AWS Elastic Beanstalk nginx 配置设置应在名为 .platform.

的文件夹中进行

文件夹结构为(.platform/nginx/conf.d/proxy.conf)

在proxy.conf里面提到:

client_body_buffer_size 50M;(the size according to your requirement).

在 .platform 文件夹中创建另一个名为 00_myconf.config 的文件,内容如下:

container_commands:
 01_reload_nginx:
   command: "service nginx reload"

关于配置 nginx 的 AWS 文档:https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html (阅读反向代理配置)