How To Install phpMyAdmin on Nginx

Install phpMyAdmin on Nginx

In this tutorial, we will show you how to install and configuration of PHPMyAdmin on the Nginx on your CentOS 6. For those of you who didn’t know, PHPMyAdmin is the web-based administration tool for managing the MySQL, MariaDB, and Drizzle servers, it helps in performing database activities such as creating, deleting, querying, tables, columns, relations, indexes, users, permissions, etc.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS and assume that you already have Nginx installed on the system. You will also need PHP-fpm to have Phpmyadmin working on Nginx.


  • A server running one of the following operating systems: CentOS 6.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo useror access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install phpMyAdmin on Nginx

Step 1. First, add EPEL yum repository to your system.

CentOS 6:

rpm -Uvh

CentOS 7:

rpm -Uvh

Step 2. Install phpMyAdmin using the following command.

yum -y install phpmyadmin php

Step 3. Configure Nginx to serve phpMyAdmin.

In Nginx, a virtual host file can be found in /etc/nginx/conf.d the directory. Let’s create a file called “phpmyadmin.conf”.

#nano /etc/nginx/conf.d/

server {
listen   80;
root /var/www/html/phpMyAdmin;
location / {
index  index.php;
## Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log        off;
expires           30d;
location ~ /\.ht {
deny  all;
location ~ /(libraries|setup/frames|setup/libs) {
deny all;
return 404;
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/phpMyAdmin$fastcgi_script_name;

Create the required directory and enable Nginx virtual host for PHPMyAdmin.

mkdir -p /var/www/html/phpMyAdmin

Step 4. Restart the services.

service nginx restart
service php-fpm restart

Step 5. Accessing phpMyAdmin Web UI.

Now open your browser and surf to http://your-ip-address/phpMyAdmin and your PHPMyAdmin will ask you for the user and password of your MySQL installation, you can use root as user and the root MySQL password, or any other MySQL user/password.

Install phpMyAdmin on Nginx

Congratulations! You have successfully installed PHPMyAdmin with Nginx. Thanks for using this tutorial for installing PHPMyAdmin on the Nginx web server on the Linux system. For additional help or useful information, we recommend you check the official PHPMyAdmin website.

Nginx Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “Nginx Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!