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.
Check which user runs nginx. As of Ubuntu 12.04 nginx runs by nginx user which is not a member of www-data group.
usermod -a -G www-data nginx
and restarting nginx and php5-fpm daemons solves the problem.