跳轉到內容
View in the app

A better way to browse. Learn more.

PHP論壇人

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

安裝phpMyAdmin、修改為 888 port、使用IP當phpMyAdmin的網址來管理資料庫

精選回覆

發表於

安裝phpMyAdmin、修改為 888 port、使用IP當phpMyAdmin的網址來管理資料庫

----------------------------
安裝phpMyAdmin
----------------------------

IP的網站目錄
/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.2
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.2/phpMyAdmin-5.2.2-all-languages.tar.gz


cd Downloads


gpg --import phpmyadmin.keyring


wget https://files.phpmyadmin.net/phpMyAdmin/5.2.2/phpMyAdmin-5.2.2-all-languages.tar.gz.asc


gpg --verify phpMyAdmin-5.2.2-all-languages.tar.gz.asc


mkdir /var/www/html/phpMyAdmin


tar xvf phpMyAdmin-5.2.2-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'] = 'DOFw4356A65IScA&Q!cDugr!lSfuBz*A';




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 設定儲存空間,部份延伸功能將無法使用。-----> 已經沒有出現這一條訊息

建立帳號或登入後發表意見

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.