phpMyAdmin is a free and open source administration tool for MySQL and MariaDB. As a portable web application written primarily in PHP, it has become one of the most popular MySQL administration tools, especially for web hosting services. In this guide, we are going to install phpMyAdmin with Nginx on CentOS 7.

Deploying your cloud server
If you have not already registered with Cloudwafer, you should begin by getting signed up. Take a moment to create an account after which you can easily deploy your own cloud servers.

Once you have signed up, log into your Cloudwafer Client Area with the password provided in your mail and deploy your Cloudwafer cloud server.

Updating System Packages on CentOS
It is always recommended that you update the system to the latest packages before beginning any major installations. This is done with the command below:

sudo yum update

Installing Nginx
Install Nginx using the CentOS package manager yum as shown below:

sudo yum install nginx

Checking Nginx Version
After installation, you can check the installed version of the Nginx web server on your CentOS 7 server by issuing the following command:

sudo nginx -v 

Install phpMyAdmin
The phpMyAdmin package is not available as an RPM package in OS repositories for CentOS 8. So, we will download the archive from the official website.

wget https://files.phpmyadmin.net/phpMyAdmin/5.0.1/phpMyAdmin-5.0.1-all-languages.tar.gz

Install phpMyAdmin using the following command.

sudo tar -zxvf phpMyAdmin-5.0.1-all-languages.tar.gz

Move the phpMyAdmin directory as shown below:

sudo mv phpMyAdmin-5.0.1-all-languages /usr/share/phpMyAdmin

Copy the sample configuration file.

sudo cp -pr /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php

Edit the configuration file and add the blowfish secret.

sudo nano /usr/share/phpMyAdmin/config.inc.php

Generate blowfish secret and update the secret in the below line.

Next, Import the create_tables.sql to create new tables for phpMyAdmin.

mysql < /usr/share/phpMyAdmin/sql/create_tables.sql -u root -p

Create a virtual host file named phpMyAdmin.conf in the /etc/nginx/conf.d.

sudo nano /etc/nginx/conf.d/phpMyAdmin.conf

Add the following making changes to the domain name. You can replace it with your own domain name or your server's IP Address.

server {
listen 80;
   server_name phpmyadmin.cloudwaferlabs.com;
   root /usr/share/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_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin$fastcgi_script_name;
   }
}

Cloudwafer-Nginx-CentOS-7