502 bad gateway error with php5-fpm on Debian 7

Francis Daly francis at daoine.org
Wed Feb 20 23:54:10 UTC 2013

On Thu, Feb 21, 2013 at 12:36:27AM +0100, GASPARD Kévin wrote:

Hi there,

> >Looking at your config file, plus every file include'd in it, can you
> >see which one server{} block is used for this request? (You'll need
> >to look at all of the "listen" directives first, and then all of the
> >"server_name" directives in the server{}s with the "listen" that best
> >matches the incoming ip:port.)
> >
> >What fastcgi_pass line is used in that one server{} block?
> I've do a grep -R 'listen' /etc/nginx/conf.d/ and every vhost  
> configuration file have two lines, exactly the same:
>         listen      80;
>         listen      443 ssl;

Ok, since all of the "listen" lines are the same, then the server{}
that is chosen depends on the host name used in the test request.

So: what is the hostname in the url that you try to get, when you see
the 502 error?

And which vhost configuration file has the matching server_name
directive? If there is no exact match, then the first regex match is
used. If there is none, then the default server{} is used. Which exactly
is "the first regex" may not be immediately obvious if there are some
in different files.

> I'm sorry but I'm not sure to understand why you are asking me to do and I  
> given you what I can. If I miss something can you point me on the good way  
> please?

The problem you report is consistent with the log output you showed.

But the configuration you showed is not consistent with that log output.

So something is unexpected.

Maybe it is simplest if you rename the conf.d directory, then create
a new conf.d directory with just one vhost file. Then reload nginx and
re-do your test of a php request and see what it says.

If it still fails, then you have a simpler test case to work from.

Francis Daly        francis at daoine.org

More information about the nginx mailing list