I update nginx to 1.4.7 and php to 5.5.12, After that I got the 502 error. Before I update everything works fine.
The problem in my case was that the Nginx web server was running as user nginx and the pool was running as user www-data.
I solved the issue by changing the user Nginx is running at in the /etc/nginx/nginx.conf
file (could be different on your system, mine is Ubuntu 16.04.1)
Change: user nginx;
to: user www-data;
then restart Nginx: service nginx restart