【问题标题】:Nginx: Client request body is buffered to a temporary fileNginx:客户端请求正文缓冲到临时文件
【发布时间】:2021-04-02 16:29:50
【问题描述】:

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

工作图片的链接如下:https://drive.google.com/file/d/1hbrEa2gNLdqGPJxp5jVxWcXl1wunp5Mc/view?usp=sharing

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

上面两张图片看起来很像。当我选择文件并将其上传以进行分析时,第一张大小约为 150kb 的图像可以使用。但是,当我从 PC 选择并上传它进行分析时,大约 10kb 的图像不会。当我尝试对我的手机浏览器执行相同操作时,都显示错误。

日志中显示的错误是 - [warn]: a client request body is buffered to a temporary file。

【问题讨论】:

    标签: amazon-web-services nginx flask amazon-elastic-beanstalk vgg-net


    【解决方案1】:

    我通过以下链接找到了答案: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 (阅读反向代理配置)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-01
      • 2016-11-18
      • 1970-01-01
      • 1970-01-01
      • 2019-07-08
      • 2012-03-18
      • 2014-11-11
      相关资源
      最近更新 更多