Learn how to change the nginx default client_max_body_size from 1MB to a higher limit to avoid 413 errors and allow larger file uploads. Our Live Support Team is always here to help you.
How to Change Nginx Default client_max_body_size
When users try uploading files and suddenly get the “413 Request Entity Too Large” error, it usually comes down to one simple reason, the nginx default client_max_body_size limit. By default, Nginx only allows uploads up to 1MB, which is too low for most real-world sites dealing with images, videos, or other large files. Let’s go through what this setting does and how you can increase it safely.

An Overview
What is the Default File Upload Size in Nginx?
Nginx isn’t just a regular web server. It also serves as a reverse proxy, load balancer, and even an email proxy (SMTP, POP3, IMAP). It’s built with a master process that reads the configuration file and manages worker processes, which handle the actual requests.
Now, regarding uploads, the nginx default client_max_body_size is set to 1MB. This default applies to most setups. When users try to upload files larger than that, for example, a 1.5MB file, they get the error:
“Nginx 413 Request Entity Too Large”
This happens because the server blocks requests that exceed the upload size limit. To fix this, you simply need to adjust the client_max_body_size directive in your configuration file.
What is client_max_body_size in Nginx?
The client_max_body_size directive is part of the nginx_http_core_module. It defines the maximum allowed size of a client’s request body, which includes file uploads. You can configure it in the http, server, or location block of your Nginx configuration depending on where you want the rule to apply.
Context of client_max_body_size:
- location
- HTTP
- server
Default value:
client_max_body_size 1M;
Syntax:
client_max_body_size size;
If you set client_max_body_size to 0, Nginx won’t check the upload size at all. However, it’s smarter to assign a proper limit that fits your application’s needs, especially for performance and security reasons.
How to Increase Nginx Default client_max_body_size
Here’s how you can raise the upload limit and allow larger files:
1. Open your Nginx configuration file, typically found at /etc/nginx/nginx.conf or within /etc/nginx/sites-available/.
2. Locate the section (http, server, or location) where you want to define the upload size limit.
3. Add or update the directive like this:
client_max_body_size 20M;
Here, the upload limit is set to 20MB, but you can adjust it as needed.
4. Save the file and restart Nginx to apply the changes:
sudo systemctl restart nginx
Once restarted, Nginx will accept uploads larger than the previous 1MB limit.
Get Expert Help Fixing Nginix

Quick Recap
The nginx default client_max_body_size is 1MB.
Increasing it prevents the “413 Request Entity Too Large” error.
You can set it under the http, server, or location block.
Setting it to 0 disables the upload limit completely (not recommended).
Don’t forget to restart Nginx after editing the configuration.
[If needed, Our team is available 24/7 for additional assistance.]
Conclusion
By increasing the nginx default client_max_body_size, you can handle larger uploads smoothly and prevent users from running into file size errors. It’s a small tweak that makes a big difference for websites dealing with media-heavy content.
