Increasing File Upload size with a nginx nodejs droplet

I am unsure where to find the error (attached the screenshots below).

So Upon trying to upload large files through a Droplet, Ubuntu, Nginx, Nodejs I am hitting a 413 Request Entity Too Large error.

Connection: keep-alive

Content-Length: 67

Content-Type: text/html

Date: Mon, 29 May 2023 21:27:18 GMT

Server: nginx/1.22.0 (Ubuntu)

X-Powered-By: Express

In the response headers I get :

nginx/1.22.0 (Ubuntu)


which tells me (I think) it’s coming from Nginx config (image/link below). In the /etc/nginx/nginx.conf I have within the http block client_max_body_size 200M however i’m still getting this 413 error.

So I’m unsure, is the error coming from Nginx and the client_max_body_size is not being picked up/listened too OR is there a limit on a single upload request and DigitalOcean is hitting some limit, I’m unsure how to have a definite answer, since I can assume it’s nginx but with the config looking correct I am unsure if it’s still nginx or DO.


image alt text

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Site Moderator
Site Moderator badge
September 14, 2023


If you’re receiving a “413 Request Entity Too Large” error, it typically originates from Nginx, as this error message is indicative of the Nginx server refusing to process the request because the request body exceeds the size limit defined in its configuration.

Here are a few troubleshooting steps to help you narrow down and hopefully resolve the problem:

Nginx Configuration:

  • Ensure you’ve modified the correct Nginx configuration file. Nginx can have multiple config files, especially if you’re using virtual hosts. Check your server block or virtual host configuration files, typically located in /etc/nginx/sites-available/ or /etc/nginx/conf.d/.

  • If you’ve modified the client_max_body_size within a specific server block, ensure it’s not being overridden elsewhere.

  • After making changes, always remember to reload or restart Nginx:

sudo systemctl reload nginx

Nginx Includes:

Nginx supports including other configuration files. Check if there are any additional configuration files being included that might be overriding your settings.

Proxy & Buffers:

If your Nginx is acting as a reverse proxy for a backend server (like Express), ensure you also configure the buffer sizes:

client_body_buffer_size 16k;
proxy_buffer_size   128k;
proxy_buffers   4 256k;
proxy_busy_buffers_size   256k;

Express/Node.js Configuration:

While the error message format you’ve shown is typical of Nginx, you should also check if there’s any body size limit set in your Express/Node.js application, especially if you’re using body parsers. For instance, with body-parser, you can set a limit:

app.use(bodyParser.json({limit: '200mb'}));
app.use(bodyParser.urlencoded({limit: '200mb', extended: true}));


Check Nginx’s error logs for any relevant messages that could offer more insights:

sudo tail -f /var/log/nginx/error.log
Bobby Iliev
Site Moderator
Site Moderator badge
June 3, 2023

Hi there,

With Nginx installed on a Droplet, there are no limits implied by DigitalOcean. This would only be the case for the App Platform.

With a Droplet, you have root access and you can adjust any of the configurations that you need.

What I could suggest checking the site-specific Nginx configuration under /etc/nginx/sites-available/. As if you have any client_max_body_size definitions in there this will override the ones that you’ve specified in the http directive.

Also, after making changes to the NGINX configuration, remember to restart or reload the service for the changes to take effect. You can do this by running sudo systemctl reload nginx or sudo service nginx reload.

Also, how large is the file that you are trying to upload?

And do you see any other errors in the Nginx error log:

tail -100 /var/log/nginx/error.log



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel