Nginx/Unit sendfile failed for upstream

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


Hello

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: 127.0.0.1, server: wp1.wrf,
request: "POST /uploader.php HTTP/1.1", upstream:
"http://127.0.0.1:8301/uploader.php", host: "wp1.wrf", referrer:
"http://wp1.wrf/zamowienie,dodaj-zdjecia.html"

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 (http://unit.nginx.org/configuration/#settings) 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
http://localhost/config/max_body_size
{
        "error": "Invalid configuration.",
        "detail": "Unknown parameter \"max_body_size\"."
}

Any help would be appreciated.
Cheers,
Bartek

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,284631,284631#msg-284631



More information about the nginx mailing list