phpmyadmin error 502 Bad Gateway on nginex

You should not use the .pid file as backend contact point.

You need to use the .sock socket file for it.