I'm having an issue on an AWS Elastic Beanstalk instance, whereby I can't seem to upload a PDF file that is 6MB in size. First, let me provide a bit more background:

  • The application running is an Expression Engine (EE) application
  • upload_max_filesize is set to 16M
  • post_max_size is set to 32M
  • max_execution_time is set to 300
  • Files are being uploaded through the EE application on Elastic Beanstalk into an Amazon S3 bucket.

I am able to successfully upload PDFs in the region of 1-2MB, but when I try to upload the 6MB file it reaches 100% uploaded and then redirects me back to the home screen in EE and the file has not been uploaded.

Does anyone know or have any ideas why I wouldn't be able to upload the 6MB file, given that the config variables above are set as such?


2 Answers 2


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:

    command: "service nginx reload"
      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.


Just in case anyone is still struggling with this, check out this SO post's first answer.

In my case, the build step only copied the .build folder to ElasticBeanstalk, thus I had to add the step - cp -R .platform ./build/.platform to my buildspec.yml's build steps in order for the .platform folder to get copied over as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .