如何解决Nginx和Amazon ElasticBeanstalk中的错误413请求实体太大? [英] How to resolve error 413 Request Entity Too Large in Nginx and Amazon ElasticBeanstalk?

查看:61
本文介绍了如何解决Nginx和Amazon ElasticBeanstalk中的错误413请求实体太大?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中上传大图像时遇到问题,我的配置是使用puma和RoR.我在elasticbeanstalk中的用户是ec2-user.

I have problems upload large images in my project, my configuration is with puma and RoR. My user in the elasticbeanstalk is ec2-user.

我尝试了许多看到的配置,但是不能正常工作. .ebextensions中的文件就是这样的:

I've tried with many configurations that I saw, but it can't works properly. the file in the .ebextensions is like this one:

files:
  "/etc/nginx/conf.d/proxy.conf" :
    mode: "000777"
    owner: root
    group: root
    content: |
        client_max_body_size 4G;

其他配置,但不起作用

files:
  "/etc/nginx/conf.d/proxy.conf" :
    mode: "000755"
    owner: ec2-user
    group: ec2-user
    content: |
        client_max_body_size 50M;

文件已创建,但未成功.有什么建议?谢谢.

The file is created but without a successful. Any suggestions? Thanks.

推荐答案

我已经解决了我的问题,我不得不在http://p>中添加client_max_body_size

I've already resolved my problem, I had to add: client_max_body_size in the http

files:
  "/etc/nginx/conf.d/proxy.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |
        http {
          client_max_body_size 20M;
        }

这篇关于如何解决Nginx和Amazon ElasticBeanstalk中的错误413请求实体太大?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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