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

Cloudwafer-Nginx-CentOS-1

Cloudwafer-Nginx-CentOS-2

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 

Cloudwafer-Nginx-CentOS-2

Step 2: Install phpMyAdmin
Install phpMyAdmin using the CentOS package manager yum as shown below:

sudo yum -y install phpmyadmin php

Cloudwafer-Nginx-CentOS-3

Cloudwafer-Nginx-CentOS-4

Step 3: Configure phpMyAdmin
After successfully installing phpMyAdmin, we are going to create a virtual host configuration as phpMyAdmin does not automatically create one itself.

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 php.cloudwaferlabs.com.ng;
        root /usr/share/phpMyAdmin;

location / {
        index  index.php;
        }

## Images and static content is treated differently
        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;
                    }
    }

Ensure to save before closing the file.

Next, restart the services:

sudo systemctl restart nginx

Install PHP-FPM Install php-fpm as shown below:

sudo yum install php-fpm

Next, restart php-fpm as shown below:

sudo systemctl restart php-fpm

Next, access phpMyAdmin from the browser on your domain name or server's IP address.

Cloudwafer-Nginx-CentOS-7