What the message looks like
2026/10/23 11:20:13 [error] 1234#1234: *3456 client intended to send too large body: 104857600 bytes, client: 198.51.100.7, server: cloud.beispiel.de, request: "PUT /remote.php/dav/files/anna/video.mp4 HTTP/2.0"Common causes
client_max_body_sizeis not set; the nginx default is 1 MB.- The directive is in the wrong context or in a file that is not included.
- A second proxy in front (load balancer, Docker proxy, Cloudflare with 100 MB on the free plan) has its own limit.
- PHP limits
upload_max_filesizeandpost_max_sizeare too small (usually an application error rather than 413).
Check
- Find the effective value in the loaded config
nginx -T 2>/dev/null | grep -n client_max_body_size - Find 413 cases in the log
grep 'too large body' /var/log/nginx/error.log | tail -n 10 - Check the PHP-FPM limits (not the CLI ones)
grep -rE 'upload_max_filesize|post_max_size' /etc/php/8.3/fpm/ - Test an upload directly
curl -s -o /dev/null -w '%{http_code}\n' -X PUT --data-binary @test-200M.bin https://cloud.example.com/upload-test
Fix
- Set
client_max_body_size 10G;in the rightserverorlocationblock (0disables the check). - Test and reload:
nginx -t && systemctl reload nginx. - Raise the same limit on every proxy in front.
- Adjust
upload_max_filesizeandpost_max_sizein PHP-FPM, thensystemctl reload php8.3-fpm. - With Nextcloud, rely on chunked uploads so single requests stay small.
Typical scenario
A user uploads a 150 MB video through the web interface and gets '413 Request Entity Too Large'. The application's nginx config already has client_max_body_size 1G;, yet the upload still fails. A second reverse proxy in front still uses the default limit of 1 MB. First find which hop writes the line 'client intended to send too large body' to its error log: that is where the effective limit sits.
FAQ
Why doesn't changing php.ini help?
Because the 413 comes from nginx before PHP ever sees the request. Also, PHP-FPM uses a different php.ini than the CLI.
Is client_max_body_size 0 a good idea?
Only behind authentication. On public endpoints it allows arbitrarily large requests and makes simple resource attacks easy.
Where can client_max_body_size be set?
In the http, server and location blocks; the most specific one wins. nginx -T | grep client_max_body_size lists every loaded value including included files, so you can see which one applies.
Is the nginx limit alone enough for large uploads?
No. For PHP applications upload_max_filesize and post_max_size also apply, and with chunked-upload clients such as Nextcloud generally only the chunk size counts. The lowest limit in the chain decides.
Is client_max_body_size 0 a good solution?
It disables the check and permits requests of any size, which exposes disks and buffers to abuse. A deliberately chosen, generous value per location is safer.