Nginx/PHP-fpm/fastcgi error: "upstream prematurely closed connection"


Well-known member
I've been testing my XenForo migration on a new server and after over a month of use, yesterday I starting getting 504 and now 502 errors on any php page I try to access. I looked in the Nginx logs and it shows the following errors:

2012/04/24 10:37:23 [error] 554#0: *15 upstream prematurely closed connection while reading response header from upstream, client:, server:, request: "GET / HTTP/1.1", upstream: "fastcgi://", host: ""
I was getting 504 errors and changed my backlog size within php-fpm.conf to "-1" per this tip:

But now 502 errors persist and I am getting the error shown above.

Does anyone have any ideas or have a server admin reference who I could hire to take a look?

This is all a bit odd since there is pretty much just me using the server right now.

Adam Howard

Well-known member
Are you using Nginx as a proxy to anything?

-proxy_pass http://node/;
    +proxy_pass http://node;
This could resolve it if you are.

You may want to check your LOGS clearly (carefully). Client: Your IP shouldn't be all ZERO.

If it was all working flawless before... 1 of 3 things has happen.

1) You changed a setting
2) You upgraded which changed a setting
3) You've been hacked.

The all zero IP gives that away.


Well-known member
Nope, not using Nginx as a proxy to anything.

I changed the ip address to all 0s for privacy reasons. I know that #1 and #2 aren't true, because Sunday night everything was fine and then Monday morning errors started popping up in the logs and I couldn't access the site.

PC me if you are available for some consulting to take a look at it.