Welcome! Log In Create A New Profile

Advanced

Re: Nginx/Unit sendfile failed for upstream

Sergey A. Osokin
June 23, 2019 09:14AM
Hi Bartek,

hope you're doing well.

Next command creates max_body_size setting on http level:

% sudo curl -X PUT -d '{"http": { "max_body_size": 8388608} }' --unix-socket \
/path/to/control.unit.sock http://localhost/config/settings

Also, it's possible to reconfigure that setting by sending next request:

% sudo curl -X PUT -d '8388609' --unix-socket \
/path/to/control.unit.sock http://localhost/config/settings/http/max_body_size

--
Sergey Osokin

On Sun, Jun 23, 2019 at 03:09:21AM -0400, Bartek wrote:
> 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
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx/Unit sendfile failed for upstream

Bartek June 23, 2019 03:09AM

Re: Nginx/Unit sendfile failed for upstream

Sergey A. Osokin June 23, 2019 09:14AM

Re: Nginx/Unit sendfile failed for upstream

Bartek June 24, 2019 09:48AM

Re: Nginx/Unit sendfile failed for upstream

Sergey A. Osokin June 24, 2019 07:44PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 284
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready