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
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
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.