一,下載phpmyadmin5:
1,官網地址:
https://www.phpmyadmin.net/
2,下載
[root@yjweb source]# wget https://files.phpmyadmin.net/phpMyAdmin/5.0.1/phpMyAdmin-5.0.1-all-languages.zip
說明:劉宏締的架構森林是一個專注架構的博客,地址:https://www.cnblogs.com/architectforest
對應的源碼可以訪問這里獲取: https://github.com/liuhongdi/
說明:作者:劉宏締 郵箱: 371125307@qq.com
二,解壓phpmyadmin:
1,創建存放php程序文件的目錄
[root@yjweb source]# mkdir /data/web/tools [root@yjweb source]# mkdir /data/web/tools/html
2,解壓,移動后目標網站所在目錄
[root@yjweb source]# unzip phpMyAdmin-5.0.1-all-languages.zip [root@yjweb source]# mv phpMyAdmin-5.0.1-all-languages /data/web/tools/html/phpmyadmin
三,給nginx增加一個server文件供訪問
注意:安全起見,此server不要使用對外公開的端口,
或者給此站或此服務器增加基於ip地址的限制
[root@yjweb conf.d]# vi /usr/local/openresty/nginx/conf/conf.d/tools.conf
內容:
server { listen 12345; server_name tools.demodomain.net; root /data/web/tools/html; index index.php index.html index.shtml index.htm; access_log /data/logs/nginxlogs/tools.access_log; error_log /data/logs/nginxlogs/tools.error_log; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_buffer_size 32k; fastcgi_buffers 10240 32k; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
四,重啟openresty后測試訪問
[root@yjweb conf.d]# systemctl stop openresty
[root@yjweb conf.d]# systemctl start openresty
地址:
http://tools.demodomain.net:12345/phpmyadmin/index.php
五,報錯的處理:
mysqli::real_connect(): (HY000/2002): No such file or directory
解決:
[root@localhost soft]# cd /data/phpweb/html/phpmyadmin/ [root@localhost phpmyadmin]# cp config.sample.inc.php config.inc.php [root@localhost phpmyadmin]# vi config.inc.php
說明:
把 localhost修改為 127.0.0.1
//$cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['host'] = '127.0.0.1';
六,查看本地centos的版本:
[webop@yjweb ~]$ cat /etc/redhat-release CentOS Linux release 8.0.1905 (Core)