I'm trying to install phpmyadmin with nginx but when I'm about to install you have to choose a web server which lists apache2 & lighttpd which I'm not using neither cause I'm using nginx. So I selected apache2. When I try to view phpmyadmin I would get 502 Bad Gateway

nginx vhost config
server {
        listen    80;
        location / {
                root /usr/share/phpmyadmin;
                index index.php;
        location ~ .php$ {
                fastcgi_pass; #this must point to the socket spawn_fcgi is running on.
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME    /usr/share/phpmyadmin/$fastcgi_script_name;  # same path as above
                include /etc/nginx/fastcgi_params;