环境说明:
[root@yunwei-test libraries]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@yunwei-test libraries]# /application/nginx-1.10.2/sbin/nginx -V
nginx version: nginx/1.10.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/application/nginx-1.10.2 --user=www --group=www --with-http_ssl_module --with-http_stub_status_module
[root@yunwei-test libraries]# mysql -V
mysql Ver 14.14 Distrib 5.6.36, for Linux (x86_64) using EditLine wrapper
[root@yunwei-test libraries]# /application/php-5.5.32/bin/php -v
PHP 5.5.32 (cli) (built: Jul 12 2018 14:10:03)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
下载PHPMyadmin软件包解压到nginx站点目录下
[root@yunwei-test ~]# wget https://files.phpmyadmin.net/phpMyAdmin/4.8.2/phpMyAdmin-4.8.2-all-languages.zip
[root@yunwei-test ~]# unzip phpMyAdmin-4.8.2-all-languages.zip
[root@yunwei-test ~]# mv phpMyAdmin-4.8.2-all-languages/* /application/nginx-1.10.2/html/
[root@yunwei-test ~]# chown -R www.www /application/nginx-1.10.2/html/ # www为nginx worker进程用户
nginx配置文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server {
listen 80;
server_name 10.0.3.59;
root html;
index index.php index.html index.htm;
access_log logs/access.log main;
location ~ .*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
}
修改/libraries/config.default.php配置文件。
39 $cfg['PmaAbsoluteUri'] = 'phpMyAdmin主机IP';
108 $cfg['blowfish_secret'] = '短语密码'; #需要32位以上
131 $cfg['Servers'][$i]['host'] = '数据库IP';
138 $cfg['Servers'][$i]['port'] = '数据库端口,默认3306';
248 $cfg['Servers'][$i]['auth_type'] = 'cookie';
262 $cfg['Servers'][$i]['user'] = '连接数据库的用户';
269 $cfg['Servers'][$i]['password'] = '对应的数据库用户密码';
# $cfg['Servers'][$i]['auth_type'] = ['http'|'cookie'|'config']
* 'config' 认证($auth_type = 'config')是最简单的模式,用户名和密码存储在 config.inc.php 文件里;
* 'cookie' 认证($auth_type = 'cookie'),以MySQL 用户登录。
# $cfg['Servers'][$i]['user']
如果 auth_type = 'config',phpMyAdmin 将使用这个账户来连接 MySQL 服务器。
浏览器访问phpMyAdmin,输入数据库用户和密码,连接数据库。
解决: 配置文件现在需要一个短语密码。
$cfg['blowfish_secret'] = '短语密码'; 设置一个32位以上的短语密码。
解决:$cfg['TempDir'] (./tmp/) 读取失败且不能建立缓存, phpMyAdmin运行速度将受影响.
修改nginx站点目录html权限为worker process用户
参考地址:
www.php.cn
www.wpdaxue.com
www.php1.cn
phpmyadmin官网地址:https://www.phpmyadmin.net/