Nginx/Unit sendfile failed for upstream

Bartek nginx-forum at
Sun Jun 23 07:09:21 UTC 2019


I have nginx (1.15.9) + unit(1.9) + php(7.2.15).

When uploading files larger then 8Mb Nginx was failing with 413 Payload too
large, so in nginx.conf, http {} section I added "client_max_body_size=0" -
it worked for nginx, but now Unit is rejecting uploads.

Everything works fine for uploads smaller then ~8MB. When I go above that
value, browser will fail with 502 Bad Gateway,  Unit will log nothing and
nginx/error.log will have a following line:

2019/06/23 08:38:14 [error] 20682#20682: *3 sendfile() failed (32: Broken
pipe) while sending request to upstream, client:, server: wp1.wrf,
request: "POST /uploader.php HTTP/1.1", upstream:
"", host: "wp1.wrf", referrer:

PHP limits: post_max_size=40M, upload_max_filesize=20M verified with phpinfo
- but uploader.php is never executed in that case (it logs every request in
separate file, no log files are created (not even empty)).

In Unit docs ( there is
something called "max_body_size", however it is impossilbe to adjust that
value. I've made PUT / POST requests to /config/max_body_size,
/config/settings/http/max_body_size and many other variations, all without
success, e.g.:

curl -X PUT -d '"30M"' --unix-socket /var/run/control.unit.sock
        "error": "Invalid configuration.",
        "detail": "Unknown parameter \"max_body_size\"."

Any help would be appreciated.

Posted at Nginx Forum:,284631,284631#msg-284631

More information about the nginx mailing list