Ubuntu下nginx服务器安装phpmyadmin

时间: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_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;
include fastcgi_config;
}
}

Notes-

/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.

安装完成后显示404找不到网页。暂时还没找出解决办法,不知是权限问题还是FastCGI有问题。

声明:本文转载于网络,文章链接:http://www.nd9p.com/7209.html