Ever tried uploading a file or submitting a form, only to be greeted by the frustrating 413 Request Entity Too Large error?
You’re not alone.
This issue commonly pops up when your server thinks the data you’re sending is “too big” to handle. Whether you’re running your site on Nginx, Apache, or even managing a WordPress website, this error can suddenly block uploads, break APIs, and confuse visitors.
In this guide, we’ll walk you through how to Fix 413 Request Entity Too Large Error on Nginx & Apache in a simple, conversational, and beginner-friendly way—so you can get your website back to accepting uploads smoothly without touching anything risky or overcomplicated.
What does 413 Request Entity Too Large Nginx Error Mean?
A 413 Request Entity Too Large Nginx Error occurs when a request made on a client-side by the visitor or user is too large to be processed by the web server. If you have set your web server to a particular HTTP request size limit, the client may experience 413 Request Entity Too Large error.

Such error mostly occurs during file upload. I came to know about this error while working on my client’s WordPress based website. I tried to upload a WordPress theme that was approximately 29MB in size.
Fixing 413 Request Entity Too Large Errors on Nginx & Apache
To fix the 413 Request Entity Too Large Error, you need to implement some necessary changes described below. By doing so, you can adjust the threshold file size for which a client or your user is allowed to upload. If the client tries to upload file size above threshold file size, the server will throw the 413 Request Entity Too Large Error. The configuration varies for both Nginx and Apache web server. You can implement the changes depending upon which web server you use.
1. Adust Nginx Configuration
To fix the issue, you need to edit the nginx.conf file.
All that you need is to open the terminal and type the following command to edit the Nginx configuration file using your favourite editor. In my case, I’m using Vim.
Using Vim editor:
sudo vim /etc/nginx/nginx.conf
Using nano editor
sudo nano /etc/nginx/nginx.conf
Now add the following line to HTTP or server block to increase threshold file size in nginx.conf, enter:
#set client body size to 2M #
client_max_body_size 30M;
This what your configuration file will look like after you add the necessary changes:
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
client_max_body_size 20M;
listen 80;
server_name localhost;
# Main location
location / {
proxy_pass http://127.0.0.1:8000/;
}
}
}
Now reload the Nginx web server by running the following command:
sudo service nginx reload
You can also check NGINX modules for the reference.
2. Adust Apache Configuration
Just like the Nginx web server client_max_body_size directive, apache web server have LimitRequestBody directive.
You can adjust it by editing the http.conf or .htaccess file.
By default, the value of the directive in Apache is set to 0. However, you may set this value to whatever number you like.
For example, if you wanted to restrict requests larger than 100MB, convert MB into bytes and add the directive value like shown below.
LimitRequestBody 104857600
Similarly, if you want to restrict requests larger than 30MB, add directive value to 31457280.
LimitRequestBody 31457280
3. Additional Configuration – PHP Users
If you are running PHP on your server, you might also want to adjust PHP settings. Your PHP installation also put a maximum upload size limit on client-side.
To adjust the configuration, you need to edit the php.ini file. The location of the php.ini file varies depending on which operating server are you using and what version of PHP you have installed on your server. In my case, I am using PHP7 on Ubuntu Server 18.04 LTE. So, to edit the php.ini file run the following command:
sudo vim /etc/php/7.0/fpm/php.ini
;This sets the maximum amount of memory in bytes that a script is allowed to allocate
memory_limit = 32M
;The maximum size of an uploaded file.
upload_max_filesize = 30M
;Sets max size of post data allowed. This setting also affects file upload.
To upload large files, this value must be larger than upload_max_filesize
post_max_size = 3M
Now restart the PHP-FPM using any one of the following commands:
sudo systemctl restart php-fpm
or
sudo systemctl restart php7.0-fpm.service
or
sudo /usr/local/etc/rc.d/php-fpm restart
Fix 413 Request Entity Too Large Error by Verifying POST Request Size
Double-Check the Actual POST Request Size
Before changing server configurations blindly, it’s a smart idea to first verify the actual size of the POST request being sent to your server. Sometimes the request payload is much larger than expected, which helps explain why the 413 error is being triggered.
One simple way to do this is by using netcat to listen for incoming requests. Start by opening a terminal and listening on port 8080:
netcat -l -p 8080
Next, configure your browser to use a proxy pointing to localhost on port 8080. Once that’s done, submit the form or upload that’s causing the error. You should see the raw HTTP request appear in the terminal, similar to this:
POST http://example.com/path/to/my/wiki/index.php HTTP/1.1
Host: example.com
Proxy-Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 217
Pay close attention to the Content-Length header. This value represents the actual size of the data being sent in the request. By comparing this number with your server’s configured limits, you can quickly determine whether the request size itself is the problem or if something else is blocking it.
Check for Proxies and Reverse Proxies
Once you’ve confirmed the request size, the next step is to ensure that your request is reaching Apache directly. If your setup includes a proxy or reverse proxy (such as Nginx, a load balancer, or a CDN), it may be enforcing its own request size limits. Many reverse proxies cap request sizes as a security measure, which can trigger a 413 error even if Apache is configured correctly.
To rule this out, review your proxy or reverse-proxy configuration and check Apache logs for any related warnings or errors. This extra verification can save time and help you pinpoint exactly where the request is being blocked.
Final Thoughts
The 413 Request Entity Too Large error may look intimidating at first, but in reality, it’s just your server asking for a little configuration fine-tuning. Once you understand why it happens and where upload limits are set, the fix becomes straightforward—whether you’re using Nginx, Apache, or a control panel–based hosting setup.
By correctly adjusting server, PHP, and application-level limits, you can permanently Fix 413 Request Entity Too Large Error on Nginx & Apache and ensure smooth file uploads, form submissions, and API requests. Take it step by step, test after every change, and you’ll not only resolve the error but also make your server more reliable and user-friendly in the long run.
That’s it! This should help you understand and resolve the 13 Request Entity Too Large Nginx Error.
If you are still facing any difficulty, ask it in the comment section.
FAQs: Fix 413 Request Entity Too Large Error on Nginx & Apache
What does the 413 Request Entity Too Large error mean?
The 413 error means your server is rejecting a request because the file size or data being sent exceeds the allowed limit set in the server or PHP configuration.
Why does the 413 error occur even for small file uploads?
This usually happens when upload limits are set very low at the server level (Nginx or Apache), in PHP settings, or within your application (like WordPress or a framework). The lowest limit always takes priority.
How do I Fix 413 Request Entity Too Large Error on Nginx & Apache permanently?
To permanently fix it, you must increase upload limits at all relevant levels—web server configuration, PHP settings, and application-level restrictions—then restart the server and test uploads.
Do I need server restart after changing the configuration?
Yes. Changes in Nginx or Apache configuration files only take effect after restarting or reloading the web server.
Can this error be fixed without SSH access?
In many cases, yes. If your hosting provider offers cPanel, Plesk, or a similar control panel, you can adjust PHP upload limits and request size settings directly from the dashboard.
Is this error related to WordPress only?
No. While it’s common in WordPress, the 413 error can occur on any website or application that handles uploads, including APIs, forms, and custom web apps.
Is it safe to increase upload size limits?
Yes, as long as you set reasonable limits based on your needs. Avoid setting unlimited values, as extremely high limits may impact server performance or security.
Why does the 413 error still appear after increasing PHP limits?
Because Nginx or Apache may still have lower request size limits. Server-level limits override PHP settings, so both must be configured correctly.
Can a CDN or firewall cause a 413 error?
Yes. Some CDNs, reverse proxies, or security firewalls also enforce request size limits. If server changes don’t work, check your CDN or firewall settings.
How can I confirm the error is fixed?
Try uploading a file slightly larger than your previous limit. If it uploads successfully without errors, your configuration changes are working correctly.

How to Fix Failed to Initialize Plugin: wplink in WordPress
Acá encontré lo que realmente me ayudo a resolver el problema a mi.
https://serverfault.com/questions/79741/php-apache-post-limit/79745#79745
Thank you for sharing this with us!
Really helpful post 👍
I’ve run into the 413 Request Entity Too Large error a few times, and this explained it in a way that actually made sense. The step-by-step approach for both Nginx and Apache is especially useful, and I like that you mentioned checking PHP and CDN limits too. Saved me a lot of trial and error. Thanks for putting this together!
Thanks a lot! 😊
Glad the guide helped and saved you some time. Appreciate the feedback!
This was a great read. I like how you didn’t just explain *what* the 413 error is, but also *why* it happens and where to look first. The Nginx and Apache sections were straightforward and easy to apply. Definitely bookmarking this for the next time this error pops up. Thanks for sharing such a practical guide!
Thanks so much! 😊
Glad you found it practical and easy to apply. Happy bookmarking!