简体   繁体   中英

Windows bash NGINX not completing successful PHP-FPM action

This is a very weird problem...

OS: Windows 10
Env : Ubuntu Bash
Nginx : nginx/1.10.3 (Ubuntu)
PHP : PHP 7.2.1-1+ubuntu16.04.1+deb.sury.org+1

When I do a test directly to PHP-FPM from the CLI, the response is just fine.

like...

SCRIPT_NAME=/status SCRIPT_FILENAME=/status REQUEST_METHOD=GET cgi-fcgi -bind -connect /run/php/php7.2-fpm.sock

to connect to this status system https://easyengine.io/tutorials/php/fpm-status-page/

On Nginx startup, it gives these errors in the log

2018/06/24 15:08:45 [alert] 6772#6772: *2 open socket #15 left in connection 4

2018/06/24 15:08:45 [alert] 6772#6772: aborting`

But if I connect to http://127.0.0.1/status to test it ( or any local url )... the request hangs until it 502's. with these headers only:

Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=UTF-8
Date: Sun, 24 Jun 2018 22:17:13 GMT
Server: nginx/1.10.3 (Ubuntu)
Transfer-Encoding: chunked

and this error shows in the nginx log

2018/06/24 15:09:48 [error] 6834#6834: *1 upstream timed out (110: Connection timed out) while reading upstream, client: 127.0.0.1, server: _, request: "GET /status HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "127.0.0.1"

But if I kill the PHP-FPM service while it is hanging, then the response shows in the browser perfectly. Just like it does from a direct CLI request.

The rest of the nginx config is default settings. I'm using sock for the fpm, not ip:port. The ip:port setup won't even work with a whole slew of other problems.

So clearly FPM is running properly... but for some reason Nginx specifically isn't able to determine when the response has finished sending and Nginx just hangs on waiting for it to be considered finished, which never happens.. so the page faults. I've been scouring every semi similar solution I can find online and nothing seems to be my same issue; nor do their methods work for me.

any ideas? Thanks!

我通过将以下内容添加到/etc/nginx/nginx.conf中的http块来解决此问题:

fastcgi_buffering off;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM