How to resolve error 413 Request Entity Too Large

2019-04-12 10:54发布

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

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;

Other configuration but it doesn't work

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.

2条回答
叼着烟拽天下
2楼-- · 2019-04-12 11:51

I've already slove that with this file :.ebextensions/01_files.config

container_commands:
  01_reload_nginx:
    command: "service nginx reload"
files:
    "/etc/nginx/conf.d/proxy.conf":
      mode: "000755"
      owner: root
      group: root
      content: |
        client_max_body_size 0;
查看更多
老娘就宠你
3楼-- · 2019-04-12 11:52

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;
        }
查看更多
登录 后发表回答