AWS Elastic Beanstalk File Upload Limit Issue

Solution 1:

If you're using NGINX or other proxy server, it may be related to it's client_max_body_size directive. To fix it create folder .ebextensions in app root, and a file .ebextensions/01_nginx.config. Then tell build script to add this directive while building your environment, adding this to your created .ebextensions/01_nginx.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 25M;

Commit your folder to git, if you're using it. Then eb deploy, cross fingers and try to upload your 6MB PDF.

However, according to my experience, sometimes you have to completely rebuild entire environment to make it work.