We've been fighting to find the solution to random and frequent 502 Bad Gateway errors on many of our websites on one of our servers. They would generate entries like this in the site's proxy_error_log:
2016/06/17 08:55:46 [error] 23668#0: *24939 upstream prematurely closed connection while reading response header from upstream, client: x.x.x.x, server: domain.tld, request: "GET /script.php.
This occurred on sites with or without Nginx enabled in the Plesk control panel, and with FPM...
502 Issue Solved
2016/06/17 08:55:46 [error] 23668#0: *24939 upstream prematurely closed connection while reading response header from upstream, client: x.x.x.x, server: domain.tld, request: "GET /script.php.
This occurred on sites with or without Nginx enabled in the Plesk control panel, and with FPM...
502 Issue Solved