A 413 means the file you're uploading is bigger than the server allows. The fix is raising the limit in the web server and PHP — both have to agree. Here is how.
Quick answer
A 413 error means the upload is larger than the server allows, and both the web server and PHP must allow it. Raise client_max_body_size in nginx and upload_max_filesize plus post_max_size in PHP, then reload nginx and PHP-FPM.
Raise it in nginx
Nginx caps the request body size. Raise client_max_body_size (in the http or server block) and reload:
client_max_body_size 64M;
# then: nginx -t && systemctl reload nginxRaise it in PHP
PHP has two limits that both must be high enough — and post_max_size should be ≥ upload_max_filesize:
upload_max_filesize = 64M
post_max_size = 64MOn a panel?
DirectAdmin/cPanel let you change the PHP values via the PHP settings/selector, and the web-server limit may be managed for you — set both there rather than editing files.
If nginx allows 64M but PHP only 8M (or vice-versa), the lower one wins and you still get an error. Raise both to the same value and restart PHP-FPM/nginx.
413 = upload too big. Raise client_max_body_size in nginx and upload_max_filesize + post_max_size in PHP, then reload.
On WordPress specifically
Even after raising server limits, WordPress's media uploader can still show its own "exceeds the maximum upload size" message if it reads a cached or lower PHP value. Check the actual limit shown on the Media > Add New screen after reloading, and confirm you edited the PHP version that's actually active — some panels run multiple PHP versions side by side.
Large file uploads timing out instead of erroring
A very large upload that's allowed by size limits can still fail if it takes longer than the request timeout. If big files fail partway through rather than being rejected outright, also check the 504 Gateway Timeout guide and raise the relevant read/execution timeouts alongside the size limits.
How to prevent upload-size errors
- Set nginx and PHP limits to the same, generous value from the start on any site handling media/files.
- Document the value somewhere so a future PHP update or panel reset doesn't quietly reset it.
- For very large files, consider chunked/resumable uploads instead of one giant request.
Related errors
If uploads fail because the account is out of space rather than a per-request size limit, that's disk quota exceeded, not a 413. If large uploads time out instead of being rejected, see 502 Bad Gateway and the 504 guide above. Migrating a large site? See how to migrate a WordPress site.