If you want to support larger file uploads and you’re hosting a node.js app via AWS which uses nginx, heres a trick that will make it pretty easy to change the default cap.

I recently had a situation where I created a file upload utility section of a clients site that is hosted on AWS. I hadn’t thought much about it so the first file I tried to upload once I had the site staged was about 4mb and immediately I hit a snag. Apparently nginx on AWS is set to a 2mb file cap by default on all uploads. I did some searching and digging and found a pretty easy way to change this.

Since you typically need to zip up your project dir and upload it to AWS, you can include a special folder that allows you to provide some configuration settings for nginx (as well as Apache). Here is the file I created and specifically set my upload limit to 50MB. First create a folder within the root of your project called .ebextensions. Within this folder create a new file named nginx.config (doesn’t matter what the name is, as long as its .config) and include the following code:




content: |

client_max_body_size 50M;


Thats it! Re-zip up your project root and upload to AWS as a new application version and youre good to go!