Jack Posted May 26, 2024 Share Posted May 26, 2024 (edited) ---------------------------- 安裝phpMyAdmin ---------------------------- Debian預設網站目錄 cd /var/www/html/ 修改 vi /etc/nginx/sites-available/default 搜尋 index index.html index.htm index.nginx-debian.html; 修改為 index index.html index.htm index.php; ESC儲存並離開 :wq 先到phpMyAdmin官網,最新版本是多少,例如 phpMyAdmin 5.2.1 https://www.phpmyadmin.net/ cd /root wget -P Downloads https://files.phpmyadmin.net/phpmyadmin.keyring wget -P Downloads https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.tar.gz cd Downloads gpg --import phpmyadmin.keyring wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.tar.gz.asc gpg --verify phpMyAdmin-5.2.1-all-languages.tar.gz.asc mkdir /var/www/html/phpMyAdmin tar xvf phpMyAdmin-5.2.1-all-languages.tar.gz --strip-components=1 -C /var/www/html/phpMyAdmin cp /var/www/html/phpMyAdmin/config.sample.inc.php /var/www/html/phpMyAdmin/config.inc.php vi /var/www/html/phpMyAdmin/config.inc.php 搜尋 $cfg['blowfish_secret'] = ''; 修改為 $cfg['blowfish_secret'] = 'JOFw435365IScA&Q!cDugr!lSfuBz*OA'; ESC儲存並離開 :wq chmod 660 /var/www/html/phpMyAdmin/config.inc.php chown -R www-data:www-data /var/www/html/phpMyAdmin 重新加载Nginx nginx -t nginx -s reload 修改 vi /etc/nginx/sites-available/default 搜尋這代碼 location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } 然後,在代碼的底下,加入 location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; } ESC儲存並離開 :wq 重新加载Nginx nginx -t nginx -s reload 現在瀏覽器可以進入phpMyAdmin (此時 http 是用 80 port) http://你的伺服器IP/phpMyAdmin --------------------------------- phpMyAdmin改為 888 port --------------------------------- 我慣用伺服器IP當作phpMyAdmin的網址,並改為 888 port,利用防火牆擋住全部IP連入,限自己的IP才能連入phpMyAdmin 預設網站目錄 /var/www/html/phpMyAdmin/ 修改為 888 port vi /etc/nginx/sites-available/default 搜尋 listen 80 default_server; 修改為 listen 888 default_server; 下面那一行,# 註解掉 #listen [::]:80 default_server; ESC儲存並離開 :wq 重新加载Nginx nginx -t nginx -s reload 重開機 reboot phpMyAdmin 已改為888 port 然後雲主機的WAF防火牆、iptables防火牆,也要修改 888 port 只允許自己的IP才可以連入 這時,防火牆都修改完畢,瀏覽器可進入你的伺服器IP http://你的伺服器IP:888/phpMyAdmin/ 出現訊息 尚未設定 phpMyAdmin 設定儲存空間,部份延伸功能將無法使用。 下載 https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz 解壓縮 phpMyAdmin-latest-all-languages.tar.gz 尋找目錄中 /sql/create_tables.sql 找到 create_tables.sql 返回瀏覽器 phpMyAdmin -> 匯入 -> 要匯入的檔案 -> 選擇檔案 -> create_tables.sql -> 匯入 返回phpMyAdmin首頁 尚未設定 phpMyAdmin 設定儲存空間,部份延伸功能將無法使用。 已經沒有出現這一條訊息 Edited July 12, 2024 by Jack Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now