nginx-black-logo

This is another way to run phpMyAdmin on Nginx.

1. Install phpMyAdmin on Nginx:

apt-get install phpmyadmin

When the pop up shows up, select neither Apache or Lighttpd. You don’t need any to run phpMyAdmin on Nginx.

Screen Shot 2013-03-29 at 12.34.34 AM

And say select NO for the Configure database for phpmyadmin with dbconfig-common:

Screen Shot 2013-03-29 at 12.34.20 AM

2. Configure phpMyAdmin to work with Nginx:

Add the followings to /etc/nginx/sites-available/default file after the server{ statement:

 location /phpmyadmin {
               root /usr/share/;
               index index.php index.html index.htm;
               location ~ ^/phpmyadmin/(.+\.php)$ {
                       try_files $uri =404;
                       root /usr/share/;
                       fastcgi_pass 127.0.0.1:9000;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
               }
               location ~* ^/phpmyadmin/(.+\.(jpeg|jpg|png|css|gif|ico|js|html|xml|txt))$ {
                       root /usr/share/;
               }
        }
        location /phpMyAdmin {
               rewrite ^/* /phpmyadmin last;
        }

3. Restart the Nginx Web Server now

/etc/init.d/nginx restart
[ ok ] Restarting nginx: nginx.

Now you can try in your browser:

http://your-ip/phpmyadmin

Optionally you can add the configuration to any virtual host from your Nginx configuration.

Valic

Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

2 responses to How to run phpMyAdmin on Nginx

  1. i got 502 Bad Gateway.
    logs said it must be fastcgi service on 9000 port, but it doesn’t.
    please, make sure your tutorial is complete.
    thanx.

  2. This tutorial is complete!

Leave a Reply