0

I have been struggling for the past few days now to increase the upload limit on nginx, which is apart my elastic beanstalk instance. From my understanding i need an ebextensions file to set the client_max_body_size. Which I have tried several different ways to configure, like directly overwriting nginx.conf to inserting client_max_body_size in nginx.conf on the live server. None of these methods have worked. I was sure to manually reload the file just after each attempt. As it stands, this is what my config file looks like at the moment(after several iteration):

.ebextensions/01_nginx.config

files:
  /etc/nginx/conf.d/proxy.conf:
    content: |
      client_max_body_size 2G;

If anyone can help me that would be awesome.

user3799793
  • 131
  • 3
  • 11

2 Answers2

0

You can either extend it or override it.

Elastic Beanstalk provides a default nginx configuration that you can either extend or override completely with your own configuration

Overriding 
    ~/workspace/my-app/
    |-- .ebextensions
    |   `-- nginx
    |       `-- conf.d
    |           `-- myconf.conf

Source

Your Config looks right from your question compared to the example from the docs. Verify location of your nginx conf by sshing into the

$ eb ssh environment-name
$ sudo service nginx configtest
nginx: the configuration file /${LOCATION}/nginx.conf syntax is ok
nginx: configuration file /${LOCATION}/nginx.conf test is successful

Doc Example

  "/home/ec2-user/myfile2" :
    content: |
      # this is my file
      # with content

Also try adding the nginx reload to the .ebextensions if you have the right path to your nginx config.

files:
  /etc/nginx/conf.d/proxy.conf:
  mode: "000644"
  owner: root
  group: root
  content: |
      client_max_body_size 2G;

commands:
  01_reload_nginx:
    command: "sudo service nginx reload"

Source

Helpful blog post that runs thru most of this: "Getting to Know and Love AWS Elastic Beanstalk Configuration Files"(.ebextensions)

strongjz
  • 4,271
  • 1
  • 17
  • 27
0

This might be helpful as it worked for me. Taking reference form aws ebs docs

To extend the Elastic Beanstalk default nginx configuration, add .conf configuration files to a folder named .platform/nginx/conf.d/ in your application source bundle. The Elastic Beanstalk nginx configuration includes .conf files in this folder automatically.

~/workspace/my-app/
|-- .platform
|   `-- nginx
|       `-- conf.d
|           `-- myconf.conf
`-- other source files

myconf.conf

client_max_body_size 50M;

Note When you add or edit an nginx .conf configuration file, be sure to encode it as UTF-8.

Prajwol KC
  • 398
  • 6
  • 13