Phone :  +370 (5) 204-1903
Email: sales@1gbits.com
  1. Dedicated server
  2. Blog
  3. How To Install phpMyAdmin with Nginx on Centos
How To Install phpMyAdmin with Nginx on Centos


Sep, 16

What is phpMyAdmin?

What is phpMyAdmin? Relational database management systems like MySQL and MariaDB are needed for a significant portion of web sites and applications. However, not all users feel comfortable administering their data from the command line. To solve this problem, a project called phpMyAdmin was created in order to offer an alternative in the form of a web-based management interface. In this guide, we will demonstrate how to install and secure a phpMyAdmin configuration on a CentOS 7 Server. We will build this setup on top of the Nginx web server, which has a good performance profile and can handle heavy loads better than some other web servers.

How To Install phpMyAdmin with Nginx

First add EPEL yum repository your system

CentOS 6:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

CentOS 7:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-1.noarch.rpm

Install phpMyAdmin using the following command

yum -y install phpmyadmin php

Configure nginx to serve phpMyAdmin

In Nginx, virtual host file can be found in /etc/nginx/conf.d directory. Lets create file called “phpmyadmin.conf”.

#nano /etc/nginx/conf.d/phpmyadmin.idroot.net.conf

server {
listen   80;
server_name phpmyadmin.idroot.net;
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 required directory and enable Nginx virtual host for phpmyadmin.

mkdir -p /var/www/html/phpMyAdmin

Restart the services

service nginx restart
service php-fpm restart

Finally, test phpMyAdmin

Now open your browser and surf to http://youripaddress/phpMyAdmin and your phpmyadmin will ask you for user and password of your mysql installation, you can use root as user and the root mysql password, or any other mysql user/password. Congratulation’s! You have successfully installed phpMyAdmin with Nginx.

author img


Leave A Comment