Right Way To Install PhpMyAdmin Through Nginx And PHP-FPM

Home » CentOS » Right Way To Install PhpMyAdmin Through Nginx And PHP-FPM
CentOS 4 Comments

First I know this is not a list for PHP or Nginx setup or something else but I’ll give it a try and ask here for support I’m running a new server with PHP 5.5.18 and Nginx 1.6.2 through FPM/FastCGI. The server is working fine since I have other websites running on it. Now I’m trying to configure phpMyAdmin and I tried this:

* 1. *Create a file under `/etc/nginx/sites-available/phpMyAdmin with this content:

server {
server_name phpmyadmin.dev pma;
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 360d;
}

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 $root$fastcgi_script_name;
}

access_log /var/log/nginx/phpmyadmin/access.log;
error_log /var/log/nginx/phpmyadmin/error.log;
}
But any time I restart Nginx service I got this error:

nginx: [emerg] unknown “root” variable nginx: configuration file /etc/nginx/nginx.conf test failed

* 2. *Create a symbolic link in `/var/www/html` to the route where phpMyAdmin was installed `/usr/share/phpMyAdmin` by running `ln -s
/usr/share/phpMyAdmin/ /var/www/html` that way Nginx start fine but when I
go to `http://devserver/phpMyAdmin` I got `Access denied.`

What I’m doing wrong? What is the right way to configure the server in order to serve phpMyAdmin as any other site?

4 thoughts on - Right Way To Install PhpMyAdmin Through Nginx And PHP-FPM

  • If SElinux is in enforcing mode, check /var/log/audit/audit.log for messages with “denied” to nginx trying accessing your pma path. Or altermatevely you could run audit2why -brvw, provided you have installed the required rpm the above command is part of beforehand. (Smth like python-policy-blah. Can’t tell from the top of my head)

  • Dear list members, sorry for top posting. Couldn’t find a respective setting on gmail mobile client at 2AM

  • SELinux is disabled so I not have any message for “deniend” on audit.log file and the second command was not found I think I need to install something else