Search code examples
amazon-web-servicesnginxamazon-elastic-beanstalk

Aws elastic beanstalk nginx config is not working for my nodejs web application


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;

Solution

  • 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.