centos nginx下安装phpmyadmin
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos nginx下安装phpmyadmin相关的知识,希望对你有一定的参考价值。
因为本人在网上搜索安装phpmyadmin大部分使用Apache安装,而线上机器不想使用Apache,最后找到了nginx下安装的也比较复杂,所以就自己写一篇算了。
安装lnmp:
在nginx配置:
[[email protected] vhost]# cat /etc/nginx/nginx.conf ******** include vhost/*.conf;
[[email protected] vhost]# cd /etc/nginx/vhost/ [[email protected] vhost]# cat phpmyadmin.conf server{ 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; } }
[[email protected] ~]# vim /etc/hosts 122.123.13.13 www.test.com
源码包下载
在官网http://www.phpmyadmin.net/下载phpMyAdmin源码包phpMyAdmin-4.0.10.20-all-languages.tar
[[email protected] vhost]# tar -xvf phpMyAdmin-4.0.8-all-languages.tar.bz2 -C /home/wwwroot [[email protected] vhost]# cd /home/wwwroot [[email protected] vhost]# mv phpMyAdmin-4.0.8-all-languages/ phpmyadmin [[email protected] vhost]# cd phpmyadmin [[email protected] vhost]# cp config.sample.inc.php config.inc.php [[email protected] 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;
[[email protected] vhost]# /usr/local/nginx/sbin/nginx -t [[email protected] 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的主要内容,如果未能解决你的问题,请参考以下文章
phpMyAdmin 502 网关错误 [CentOS7, nginx]
centos7安装Lnmp(Linux+Nginx+MySql+Php+phpMyAdmin+Apache)