Skip to content

Tutorials Troubleshooting & errors Intermediate1 min read

How to Fix 413 Request Entity Too Large

Fix the 413 error when uploading files: raise Nginx client_max_body_size, Apache LimitRequestBody and PHP upload limits, safely and step by step.

By ZSOLNET Editorial Team Updated

Key takeaways

  • 413 means the upload is bigger than a limit somewhere between the browser and PHP.
  • There are usually two limits to raise: the web server's and PHP's.
  • Raise limits to what you need, not to unlimited.

413 Request Entity Too Large (called Content Too Large in newer specs) means the request body — usually a file upload — is larger than the server is configured to accept.

Where the limits live

LayerSettingTypical default
Nginxclient_max_body_size1 MB
ApacheLimitRequestBodyunlimited or 1 GB
PHPupload_max_filesize2 MB
PHPpost_max_size8 MB

The upload must fit under every limit in the chain.

On a VPS with Nginx

  1. Edit the site’s server block, for example /etc/nginx/sites-available/example.com:
server {
    client_max_body_size 64M;
    # ...
}
  1. Test and reload: sudo nginx -t && sudo systemctl reload nginx.
  2. Raise PHP’s limits in php.ini (path shown by php --ini), then restart PHP-FPM:
upload_max_filesize = 64M
post_max_size = 72M

On Apache

Check for a LimitRequestBody directive in the virtual host or .htaccess and raise it (the value is in bytes), then reload Apache.

On cPanel hosting

  1. Open Software → MultiPHP INI Editor and choose your domain.
  2. Set upload_max_filesize and post_max_size (keep post_max_size slightly larger).
  3. Save, then retry the upload.

Frequently asked questions

I raised upload_max_filesize but still get 413. Why?

413 is returned by the web server before PHP runs. On Nginx, raise client_max_body_size; on Apache, check LimitRequestBody. Then make sure post_max_size is also larger than the file.

Can I fix this on shared hosting?

Usually yes for PHP limits, through cPanel's MultiPHP INI Editor. The web server limit on shared hosting is normally set generously; if it isn't, ask support.

Share X LinkedIn Facebook

Log in to your account

Manage your domains, hosting and invoices in one place.

Secure connection straight to the ZSOLNET client area.

No account yet?