You can customize the software on a Linux Elastic Beanstalk instance using environment configuration files. For your specific case, in your local application home folder, you should have a .ebextensions directory. In that folder create a new file, let's call it "nginx.config", and place the following into that file:
---
files:
/etc/nginx/conf.d/00_client_max_body_size.conf:
content: "client_max_body_size 10m;"
group: root
mode: "000644"
owner: root
This instructs Elastic Beanstalk to create a file in /etc/nginx/conf.d/ called 00_client_max_body_size.conf, and to place a single line in this file containing:
client_max_body_size 10m;
Bundle up your application and upload a new version to Elastic Beanstalk. Once you have done this, you will notice the following on your Linux instance:
$ ls -al /etc/nginx/conf.d
total 20
drwxr-xr-x 2 root root 4096 Mar 8 00:34 .
drwxr-xr-x 4 root root 4096 Feb 15 22:24 ..
-rw-r--r-- 1 root root 25 Mar 8 00:34 00_client_max_body_size.conf
-rw-r--r-- 1 root root 1351 Mar 8 00:35 00_elastic_beanstalk_proxy.conf
-rw-r--r-- 1 root root 283 Dec 13 00:21 virtual.conf
This will get included by the main nginx.conf
file that is present on all nodejs elastic beanstalk environments, as this file has a line at the end of its http block as follows:
http {
...
include /etc/nginx/conf.d/*.conf;
# End Modification
}