2

I am using amazon elastic beanstalk for my nodejs website with nginx as proxy. I want to set the maximum upload size to 20mb as the default size is 1mb. I have tried all possible ways of setting up client_max_body_size in .ebextensions/.config file. But none seem to be working as i still get the 413 error. Below is my config file


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

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

2 Answers 2

5

The /etc/nginx/conf.d/proxy.conf is for Amazon Linux 1 (AL1). However, you may be using current version of EB (not specified in the question), which is Amazon Linux 2 (AL2).

For AL2, you should use the config files in .platform/nginx/conf.d/.

There are many differences between AL1 and AL2 in EB:

Thus you may need to modify extra files to make your application work if you are migrating it from AL1 to AL2.

Sign up to request clarification or add additional context in comments.

5 Comments

You are a saviour! This worked like a charm! So much time wasted over a silly mistake! Thank you!! Im running AL2 and configuring nginx in .platform did the trick!
I am trying to set my clent_max_body_size setting for nginx also. I think I put it into the right folder, could you post what your final configuration file looks like?
@J.Chaney Maybe it would be a good idea to make new question specific to your setup and error messages if any?
@Marcin I did, but, I would like to know if I setup my conf.d file correctly and looking at an example would help. I've searched for examples online. I think my example matches, but, I'm still having issues. I have created a separate question about my issue specifically though.
This link is more relevant
0

For Elastic Beanstalk - Amazon Linux 2:

Create .platform/nginx/conf.d/client_max_body_size.conf in the application root folder.

Add one line to the file: client_max_body_size 20M;

Deploy your code.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.