Home CentOS Installing phpMyAdmin with Nginx on CentOS 7

Installing phpMyAdmin with Nginx on CentOS 7

243
0

phpMyAdmin is free open source software that focuses on MySQL database management. It’s very easy to use and available as a standard database tool in almost all web-based control panels like cPanel-WHM, Plesk, Vesta, etc.

To install phpMyAdmin on CentOS 7 running Nginx web server, simply run the following command.

1.) Install Epel Release for RHEL 7 / CentOS 7.

$ yum install epel-release

2.) Configure phpMyAdmin

Then, simply run this command to bring phpMyAdmin on your CentOS 7.

$ yum install phpmyadmin

3.) Create Nginx ServerBlock for phpMyAdmin

After that, we need to create default serverblock inside conf.d Nginx directory. Like this one…

$ nano /etc/nginx/conf.d/default.conf
# Default ServerBlock Configuration (Please don't alter these files manually)
server {
       listen 80; ## listen for iPv4 Address
       #listen [::]:80 default ipv6only=on; ## listen for ipv6

       root /usr/share/nginx/html/;
       index index.htm index.php index.html;

       server_name knot35.com www.knot35.com;
       access_log /var/log/nginx/knot35.com.access.log;
       error_log /var/log/nginx/knot35.com.error.log;

       location / {
               try_files $uri $uri/ /index.php?$args;
       }

       location ~ \.php$ {
               try_files $uri =404;
               fastcgi_pass 127.0.0.1:9000;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
               include fastcgi_params;
               fastcgi_index index.php;
               fastcgi_param HTTP_PROXY "";
               #include fastcgi.conf;
               # fastcgi_intercept_errors on;
       }

       location = /robots.txt { access_log off; log_not_found off; }
       location ~ /\. { deny all; access_log off; log_not_found off; }

       #error_page 404 /404.html;
       # redirect server error pages to the static page /50x.html
       #
       error_page 500 502 503 504 /50x.html;
       location = /50x.html {
       root /usr/share/nginx/html;
       }

}

NOTE: make sure the value for fastcgi_pass 127.0.0.1:9000 matches your PHP-FPM configuration.

5.) Create Symlink

Then create symbolic link (symlink) with your web root directory

$ ln -s /usr/share/phpMyAdmin /usr/share/nginx/html

6.) Restart Nginx and PHP-FPM

$ systemctl restart nginx
$ systemctl restart php-fpm

LEAVE A REPLY

Please enter your comment!
Please enter your name here