7

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?

Cian Leonard
  • 81
  • 1
  • 4

1 Answers1

3

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.

Ilya Rusanen
  • 165
  • 6