系统相关
首页 > 系统相关> > ruby-on-rails – 如何在Nginx和Amazon ElasticBeanstalk中解决错误413请求实体太大?

ruby-on-rails – 如何在Nginx和Amazon ElasticBeanstalk中解决错误413请求实体太大?

作者:互联网

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

我尝试过很多我看过的配置,但它无法正常工作. .ebextensions中的文件就像这样:

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;

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

解决方法:

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

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

标签:ruby-on-rails,nginx,amazon-web-services,amazon-ec2,elastic-beanstalk
来源: https://codeday.me/bug/20190824/1711981.html