A 413 response means a request body or upload is larger than a configured limit. Check every layer that receives the upload.
Symptoms
- Uploads fail with 413.
- Large JSON payloads fail while small requests work.
- The app logs show nothing because Nginx rejects the request first.
Likely causes
- client_max_body_size is too low.
- PHP or app upload limits are smaller than Nginx limits.
- CDN or reverse proxy has its own body-size limit.
Fix steps
- Set client_max_body_size in the correct http, server or location block.
- Align PHP post_max_size and upload_max_filesize when PHP receives the upload.
- Run nginx -t before reload.
Verify the fix
- Test with a known file size.
- Check response headers to confirm which layer returns 413.
- Review Nginx error logs after the request.
FAQ
Where should client_max_body_size go?
Use the narrowest block that matches the upload endpoint unless the limit is site-wide.
Can PHP fix Nginx 413?
No, if Nginx rejects the request first. Both layers may need aligned limits.
Related tools and guides
Last updated: May 18, 2026