Gareth Pursehouse
Gareth Pursehouse

Reputation: 67

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!

Upvotes: 0

Views: 883

Answers (1)

Elijah Horton
Elijah Horton

Reputation: 21

I fixed this by adding the following to the http block in /etc/nginx/nginx.conf :

fastcgi_buffering off;

Upvotes: 1

Related Questions