How To Install phpMyAdmin with Nginx on CentOS 7 / RHEL 7

phpMyAdmin is an open-source web-based administration tool for managing the MySQL and MariaDB servers, and it helps in performing databases activities such as creating, deleting, querying, tables, columns, relations, indexes, users, permissions, etc.

This guide will help you to install phpMyAdmin on CentOS 7 / RHEL 7.


Before proceeding to the installation of phpMyAdmin, install LEMP stack (Nginx, MariaDB, and PHP) on the server.

READ: Install Nginx, MariaDB, and PHP-FPM on CentOS 7 / RHEL 7

In CentOS 7, we need to enable EPEL repository to download and install phpMyAdmin.

rpm -Uvh

Install phpMyAdmin

In our LEMP tutorial, we used Remi repository to install PHP v7.3 on the system. So, in this tutorial also we will temporarily enable Remi repository and install PHP support packages required for phpMyAdmin.

Install phpMyAdmin using the YUM command.

yum install --enablerepo=remi-php73 phpmyadmin

Configure phpMyAdmin

The phpMyAdmin rpm package does not put any configuration file for Nginx. So, we have to create a virtual host file manually as per our requirement. In Nginx, virtual host files can be found in /etc/nginx/conf.d directory.

Let’s create a virtual host file called phpMyAdmin.conf under /etc/nginx/conf.d directory.

vi /etc/nginx/conf.d/phpMyAdmin.conf

Paste the following content into the file. Modify it as per your requirement.

server {
        listen   80;
        server_name phpmyadmin.itzgeek.local;
        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_index index.php;
        fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin$fastcgi_script_name;

Restart the services.

systemctl restart nginx

systemctl restart php-fpm

Configure the firewall to allow HTTP request from the external network.

firewall-cmd --permanent --add-service=http

firewall-cmd --reload

Access phpMyAdmin

Now, access the phpMyAdmin from the browser using the below URL.


Log in as the root or database user.

Install phpMyAdmin with Nginx on CentOS 7 – phpMyAdmin Login Page

You will get the database page.

Install phpMyAdmin with Nginx on CentOS 7 – phpMyAdmin


I hope this post helped you to install phpMyAdmin on CentOS 7 to manage databases over a web browser. Please share your feedback in the comments section.

centos 7mariadbmysqlnginxphpphpmyadmin
Comments (1)
Add Comment
  • Henry

    Very nice tutorial.

    Maybe it is only me but I had to edit /etc/phpMyAdmin/ and had to set AllowNoPassword for root on True else I had no access 🙂

    But thank you for the walkthrough. I love to follow them (LEMP setup was/is also great to do!)