时间:16-10-09 来源: 作者: 点击:

phpMyAdmin, by default is configured to work with Apache and Lighttpd (not positive of the last one) – and not nginx. This website’s server runs on nginx, I tracked down a way of making it work – assuming you have some way of loading PHP, like FastCGI (post coming soon) installed.

Firstly, install phpMyAdmin (I used centOS / Ubuntu so I ran # yum install phpMyAdmin  or apt-get install phpmyadmin respectively).

Once that’s done, open up the virtual host config file for nginx – in CentOS it’s /etc/nginx/conf.d/virtual.conf and add the following:

server {
listen (IP ADDRESS):80;
server_name phpmyadmin.domainname.com;

location / {
root /usr/share/phpmyadmin;
index index.php;

location ~ \.php$ {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;
include fastcgi_config;


/usr/share/phpmyadmin should be replaced by the directory that phpMyAdmin is installed in, run
# whereis phpmyadmin
to locate.

The latter section is specific to the FastCGI process I’m using and may be different for different PHP handlers – but in general that’s how it works.

Save that file, and reload nginx, head over to phpmyadmin.domainname.com and boom – phpMyAdmin running on nginx.