w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Nginx throw 502 bad gateway on php5-fpm setup

This is how a typical response works: a request is sent to Nginx, which sends that request to PHP-FPM on behalf of the client browser; PHP-FPM responds with its evaluated code, then sends that response back to Nginx. In your situation, this is still happening. The problem is that PHP-FPM is not sending the result you want. You want code to be evaluated, but instead it is saying it cannot read the code, more or less, so it tells Nginx that it dun goofed, and so Nginx tells the client browser that the "gateway" (the upstream server, being PHP-FPM) is being a douche; that is, it sends the client browser a 502 response, because it cannot show up to the boss empty handed.

What does this mean?

It means, unsurprisingly, that permissions are wrong. Permissions are preventing PHP-FPM from doing its thing. Find PHP-FPM's www.conf file, and adjust the listen.owner, listen.group, listen.mode, user, and group settings. Also, just use a socket. This is configured in the same place. Actually, the permission settings I just listed will only work with sockets. Nevertheless, if you want to continue running Nginx on a listening port, it is still a permissions issue.

Your logs would easily state this. Did you really investigate this problem? Search engines are probably inundated with results pertaining to this very information.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.