Talk to the NOC, IST hours — +91 75994 50220 support@bigdomainhost.com
Guide

How to fix a 413 Request Entity Too Large error

A 413 means something between the browser and your code decided the upload was too big. This guide shows how to tell which layer said no, and how to raise the limit in Nginx, Apache, PHP, WordPress, Cloudflare and Express.

Short answer: 413 Request Entity Too Large means the server refused a request because its body, usually an upload, was larger than a configured limit. Find which layer sent it, then raise that limit and every one behind it: client_max_body_size in Nginx (default 1m), LimitRequestBody in Apache, upload_max_filesize and post_max_size in PHP, the plan limit on Cloudflare, or the body-parser limit in a Node.js app.

What a 413 Request Entity Too Large error means

A 413 error means a server refused your request because the body was bigger than it is set to accept. It almost always happens during an upload: a large image, a video, a theme or plugin zip, a database import or a big JSON payload sent to an API. The fix is to find which layer sent the 413 and raise the limit on that layer, plus every layer behind it.

The name has changed over the years. RFC 2616 called it "Request Entity Too Large", RFC 7231 renamed it "Payload Too Large", and RFC 9110, the current HTTP standard, calls it "413 Content Too Large". All three names mean the same status code, and servers still print whichever name they were built with.

Which layer sent the 413?

A request can pass through several pieces of software before it reaches your code, and each one can have its own size limit. The lowest limit on the path wins.

  • A CDN or proxy in front, such as Cloudflare. If the error page carries Cloudflare's branding, the request never reached your server.
  • The web server: Nginx, Apache or LiteSpeed. Nginx's default error page shows "413 Request Entity Too Large" with "nginx" underneath.
  • PHP. When a PHP limit is exceeded, the request usually reaches your site and the application reports an error, for example WordPress saying the file "exceeds the upload_max_filesize directive in php.ini", instead of a bare 413 page.
  • The application itself, such as a Node.js app whose body parser rejects large payloads with a 413.

Open your browser's developer tools, go to the Network tab and look at the failing request. The response headers and body usually name the server. Nginx's documentation also warns that browsers cannot always display this error correctly, so an upload form may just stall or show a generic failure.

LayerSettingDefaultWhere to change it
Nginxclient_max_body_size1mhttp, server or location block
Apache 2.4LimitRequestBody1073741824 bytes (1 GiB) in current releases; 0 (unlimited) in 2.4.53 and earlierServer config, virtual host, directory or .htaccess
PHPupload_max_filesize2Mphp.ini, .user.ini, or .htaccess when PHP is an Apache module
PHPpost_max_size8MSame as above
CloudflareMaximum Upload Size100 MB on Free and Pro, 200 MB on Business, up to 5 GB on EnterpriseSet by the plan
Express (Node.js)limit on express.json() and express.urlencoded()100kbApplication code

The PHP defaults are the values in PHP's own manual. Hosting companies and Linux distributions often ship different values, so always check what your server is actually using.

Quick checklist

  1. Note the exact size of the file or request that fails, and the exact error text.
  2. Find which layer answered: CDN, web server, PHP or the app.
  3. Raise the limit on that layer to a little above the size you need, not to unlimited.
  4. Raise every layer behind it too. A bigger Nginx limit does not help if PHP still stops at 2M.
  5. Reload the service, or wait for cached settings to expire.
  6. Test the upload again and confirm the new values took effect.

Nginx: client_max_body_size

Nginx checks the size of every request body against client_max_body_size. The default is 1m, which is too small for most media uploads, so this is the most common cause of a 413 on a VPS running Nginx. The directive is allowed in the http, server and location contexts. Setting it to 0 disables the check, which is not a good idea on a public site.

To raise it for one site, add it to that site's server block, for example in /etc/nginx/sites-available/example.com on Ubuntu:

server {
    server_name example.com;
    client_max_body_size 64m;
    # rest of the server block
}

To allow large bodies only on an upload endpoint, put it in a location block instead, such as location /api/upload. To change it for every site on the server, put it in the http block of /etc/nginx/nginx.conf. A value in a more specific block overrides the one above it.

Test the configuration, then reload Nginx so it picks up the change without dropping connections:

sudo nginx -t
sudo nginx -s reload

On a systemd distribution such as Ubuntu, sudo systemctl reload nginx does the same job. If Nginx passes PHP requests to PHP-FPM, raise the PHP limits as well (see below).

Apache: LimitRequestBody

Apache's LimitRequestBody sets the maximum request body in bytes, and 0 means unlimited. The Apache documentation records that the default changed: in 2.4.53 and earlier it was 0 (unlimited), and current 2.4 releases default to 1073741824 bytes, which is 1 GiB. So a server that never had a body limit can start refusing very large uploads after an upgrade, and a hosting company or control panel may also have set a lower value.

The directive works in the server config, a virtual host, a <Directory> section or .htaccess. For example, to allow up to 100 MiB in one folder:

<Directory "/var/www/example.com/uploads">
    LimitRequestBody 104857600
</Directory>

Check the syntax and reload Apache on Ubuntu or Debian:

sudo apachectl configtest
sudo systemctl reload apache2

The value is in bytes, not megabytes. Writing 100 means 100 bytes, which would break almost every form on the site.

PHP: upload_max_filesize, post_max_size and memory_limit

For PHP sites, including WordPress, three settings control uploads:

  • upload_max_filesize: the largest single uploaded file. PHP's default is 2M.
  • post_max_size: the largest whole POST request, including all files and form fields together. PHP's default is 8M. The PHP manual says it must be larger than upload_max_filesize. If the POST data is bigger than this, $_POST and $_FILES arrive empty.
  • memory_limit: the most memory one script may use. PHP's default is 128M, and the manual says that, generally speaking, it should be larger than post_max_size.

There is also max_file_uploads, the number of files allowed in one request, which defaults to 20. The three size settings above accept the shorthand K, M and G.

upload_max_filesize and post_max_size have the mode INI_PERDIR. That means they can be set in php.ini, .htaccess, httpd.conf or .user.ini, but not with ini_set() inside a script. A line of PHP code in your application cannot raise them.

On cPanel: MultiPHP INI Editor

  1. Log in to cPanel and open Software > MultiPHP INI Editor.
  2. In Basic Mode, choose the domain from the menu, or Home Directory to apply the change to all your sites.
  3. Set upload_max_filesize, then set post_max_size to a higher value, and adjust memory_limit if needed.
  4. Click Apply.

cPanel writes the change to php.ini, .user.ini and .htaccess, in each file only where that file supports the directive.

By hand: php.ini or .user.ini

On your own server, edit the php.ini that the web server uses. With PHP-FPM on Ubuntu or Debian that is /etc/php/<version>/fpm/php.ini, for example /etc/php/8.3/fpm/php.ini on Ubuntu 24.04, whose default PHP is 8.3. Newer releases ship a newer PHP, so check your version first with php -v or ls /etc/php. The php --ini command shows the command-line configuration, which can be a different file, so confirm the "Loaded Configuration File" line in a phpinfo() page served through the web server. Then set, for example:

upload_max_filesize = 64M
post_max_size = 72M
memory_limit = 256M

Restart PHP-FPM with sudo systemctl restart php8.3-fpm, changing 8.3 to the version you found. Delete any phpinfo() file once you are done, because it exposes server details.

Where PHP runs as CGI or FastCGI, you can also put the same lines in a .user.ini file in the site's folder. PHP re-reads these files every 300 seconds by default (user_ini.cache_ttl), so a change can take up to five minutes to show. If PHP runs as an Apache module instead, use php_value lines in .htaccess. Our PHP guide explains how to check and change the PHP version.

WordPress: media, theme and plugin uploads

WordPress shows the current limit on Media > Add New Media File as "Maximum upload file size". That figure comes from PHP: WordPress takes the smaller of upload_max_filesize and post_max_size. The same limit applies when you upload a theme or plugin zip from the dashboard.

Two common mistakes:

  • Editing wp-config.php. WP_MEMORY_LIMIT in wp-config.php only sets how much memory WordPress asks for. It does not raise the upload limit, and because the upload settings are INI_PERDIR, an ini_set() line there cannot either. Change the PHP settings as described above.
  • Raising only upload_max_filesize. If post_max_size stays smaller, large uploads still fail. WordPress may then report that the file is empty and suggest that post_max_size is smaller than upload_max_filesize.

If the dashboard upload fails with a 413 page rather than a WordPress message, the web server or a CDN stopped it before PHP saw it. For a large theme or plugin you can also skip the browser: upload the zip over SFTP or cPanel's File Manager and extract it into wp-content/themes or wp-content/plugins.

Proxies, CDNs and Node.js apps

Cloudflare and other CDNs

When a domain is proxied through Cloudflare, Cloudflare enforces its own upload limit before the request reaches your server. Its documentation lists 100 MB on the Free and Pro plans, 200 MB on Business, and up to 5 GB on Enterprise. Larger requests get a 413 from Cloudflare, and no setting on your server changes that.

Cloudflare suggests three ways around it: split the upload into smaller requests if your application supports that, set the DNS record used for uploads to DNS-only so it is not proxied, or move to a higher plan. Our guide to what a CDN is explains proxying in more detail. Other reverse proxies and load balancers have their own limits too, so check every hop.

Node.js and Express

Express's express.json() and express.urlencoded() middleware reject bodies over their limit option, which defaults to 100kb. The error has status 413 and type entity.too.large. Raise it to what your API really needs:

app.use(express.json({ limit: '5mb' }));

Keep the limit modest. Large JSON bodies cost memory and time to parse, and files are better sent as multipart uploads. If Nginx sits in front of the app, its client_max_body_size must be at least as large as the app's limit, or Nginx answers with a 413 first. If Nginx instead reports that the app failed, see the 502 Bad Gateway guide.

Fixing a 413 on Bigdomainhost hosting

Bigdomainhost's Web & cPanel hosting and WordPress hosting run on LiteSpeed with cPanel, on servers in Mumbai. Change the PHP upload settings for each domain in the MultiPHP INI Editor as described above. If a 413 continues after that, the limit is probably set at the web server or at a CDN such as Cloudflare in front of the site. Check the error page first. If it is not a CDN's page, send the domain name and the file size to support on WhatsApp at +91 75994 50220 at any time, or call the same number in IST working hours.

On a KVM VPS you have full root access, so you set the Nginx, Apache and PHP limits yourself. Servers are in Mumbai and Delhi NCR and are prepaid in 30-day periods.

This guide was drafted with AI assistance and checked against the official documentation listed in the sources on 23 November 2026.

Sources (checked )

Answers

Frequently asked questions

Still unsure? Call +91 75994 50220 or write to support@bigdomainhost.com — a human replies in IST hours.

What does 413 Request Entity Too Large mean?

It means the server refused the request because the body was larger than a configured limit. It usually appears when uploading a large file or sending a big form or API payload. The current HTTP standard, RFC 9110, calls the same status 413 Content Too Large.

How do I fix 413 Request Entity Too Large in Nginx?

Add client_max_body_size with a larger value, for example 64m, to the http, server or location block. Run sudo nginx -t to test the configuration and then reload Nginx. The default is 1m, which is why large uploads fail on a fresh Nginx server.

How do I fix 'the uploaded file exceeds the upload_max_filesize directive in php.ini'?

Raise upload_max_filesize in PHP, and set post_max_size to a larger value, because the PHP manual says post_max_size must be larger than upload_max_filesize. On cPanel, use Software and then MultiPHP INI Editor for the domain. On your own server, edit the php.ini used by PHP-FPM and restart it.

How do I increase the upload size in WordPress on cPanel?

Open the MultiPHP INI Editor in cPanel, pick the domain, and raise upload_max_filesize and post_max_size. WordPress shows the smaller of these two as its Maximum upload file size. Defining WP_MEMORY_LIMIT in wp-config.php does not change the upload limit.

What is the Cloudflare upload size limit?

Cloudflare's documentation lists 100 MB on the Free and Pro plans, 200 MB on Business and up to 5 GB on Enterprise. Bigger requests to a proxied domain get a 413 from Cloudflare before they reach your server. You can split uploads, use a DNS-only record for uploads, or change plan.

What is 413 Payload Too Large in Node.js or Express?

Express's express.json() and express.urlencoded() reject bodies larger than their limit option, which defaults to 100kb, with status 413. Pass a larger limit, such as express.json({ limit: '5mb' }), only as large as you need. If Nginx is in front, its client_max_body_size must also be large enough.

Support that picks up the phone.

In IST hours, in Hindi or English, and WhatsApp replies fastest at any time. Sales, migration and emergencies all reach the same engineers. No offshore queue, no 48-hour first reply.

Need cPanel or WHM with the ports already sorted?

Web & cPanel hosting comes with cPanel ready to log in to, reseller hosting adds white-label WHM, and a KVM VPS can have cPanel & WHM pre-installed. Call +91 75994 50220 or email support@bigdomainhost.com.