Run phpMyAdmin on Nginx in Ubuntu Precise

Previous: MariaDB – Installation on Ubuntu Precise

1. Install phpMyAdmin.

  • apt-get install phpmyadmin

 

2. Select neither Apache nor Lighttpd for the web server selection as we want to run it in Nginx.
 

3. And say NO for the Configure database for phpmyadmin with dbconfig-common?
 

4. Append the following settings in /etc/nginx/sites-available/default. Place it inside the server{}.
/etc/nginx/sites-available/default

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

 

5. Restart the Nginx/

  • /etc/init.d/nginx restart

 

6. Browse the following URL.

http://<your domain>/phpmyadmin

nginx-phpmyadmin
 

Done =)

Reference:

Advertisement

12 thoughts on “Run phpMyAdmin on Nginx in Ubuntu Precise”

  1. Hi, My testing environment is Centos 6.4, Nginx 1.4.2, Php-fpm, Mysql. Now, your tutorial is a great starter for me 🙂 I have managed to pull up drupal installation with ease. but got stuck with phpmyadmin. I am getting following error message. here are my configuration nginx, pool & error http://pastebin.com/FnSMKkfS
    php.ini http://pastebin.com/Vnbq2Jnc
    can you please help where I am going wrong? Thanks

    Like

      1. locate command: no output
        whereis command shows below

        [root@localhost ~]# whereis phpmyadmin
        phpmyadmin:

        Like

      2. See if it is in /etc/phpMyAdmin.

        If you still couldn’t find it. then i have no idea on where it is installed.

        after you find the correct path, update the root /usr/share/; to the corresponding folder and restart the nginx.

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.