因为本人在网上搜索安装phpmyadmin大部分使用Apache安装,而线上机器不想使用Apache,最后找到了nginx下安装的也比较复杂,所以就自己写一篇算了。
安装lnmp:
在nginx配置:
[root@cml vhost]# cat /etc/nginx/nginx.conf******** include vhost/*.conf;
[root@cml vhost]# cd /etc/nginx/vhost/[root@cml vhost]# cat phpmyadmin.confserver{ server_name www.test.com; index index.html index.htm index.php; root /home/wwwroot/phpmyadmin; location ~ .*\.(php|php5)?$ { fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; include fastcgi.conf; }}
[root@cml ~]# vim /etc/hosts122.123.13.13 www.test.com
源码包下载
在官网http://www.phpmyadmin.net/下载phpMyAdmin源码包phpMyAdmin-4.0.10.20-all-languages.tar
[root@cml vhost]# tar -xvf phpMyAdmin-4.0.8-all-languages.tar.bz2 -C /home/wwwroot[root@cml vhost]# cd /home/wwwroot[root@cml vhost]# mv phpMyAdmin-4.0.8-all-languages/ phpmyadmin[root@cml vhost]# cd phpmyadmin[root@cml vhost]# cp config.sample.inc.php config.inc.php[root@cml vhost]# vim config.inc.php(修改一下地方)$i = 0;/* * First server */$i++;/* Authentication type */$cfg['Servers'][$i]['auth_type'] = 'cookie';/* Server parameters */$cfg['Servers'][$i]['host'] = '127.0.0.1'; ##假如mysql使用其他地址登录的话就修改成其他地址$cfg['Servers'][$i]['connect_type'] = 'tcp';$cfg['Servers'][$i]['compress'] = false;/* Select mysql if your server does not have mysqli */#$cfg['Servers'][$i]['extension'] = 'mysqli';$cfg['Servers'][$i]['AllowNoPassword'] = false;
[root@cml vhost]# /usr/local/nginx/sbin/nginx -t[root@cml vhost]# /usr/local/nginx/sbin/nginx -s reload
假如mysql没密码,我建议还是加上密码:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD '******'
访问:http://www.test.com
centos nginx下安装phpmyadmin
原文地址:http://blog.51cto.com/legehappy/2064539