[ubuntu]經由docker安裝wordpress

在一台ubuntu主機上(此測試是在20.04版本上),使用編輯器新增一個檔案名為idwp.sh

#vi idwp.sh

按i進入編輯狀態,然後將底下的內容copy後貼到檔案中

#!/bin/bash
sudo apt install -y curl
sudo curl -sSL http://www.twlais.com/study/docker/ui-dc-wp | bash

按ESC後再按:wq存檔離開, 再以管理者執行它

#sudo bash idwp.sh

即可自動安裝完成, 再以http://[你的ubuntu主機IP]:8031 即可看到安裝完成的設定畫面

[CentOS]變更系統時區

CentOS 6
調整系統時間前,先檢查作業系統的時區,目前位置為台北,檢查ZONE為Asia/Taipei,其實全台灣在CentOS作業系統算同一時區,若非目前時區可以做修改。

# vi /etc/sysconfig/clock

ZONE="Asia/Taipei"

變更系統時間

# cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime

執行 clock –systohc 將目前系統時間寫入 BIOS 時間

# clock --systohc

輸輸入 date 與 hwclock 看看時間是否一致

# date
Thu Jun 26 09:49:48 CST 2008
# hwclock
Thu Jun 26 09:49:51 2008  -0.179890 seconds

CentOS 7
找出你的國家

# timedatectl list-timezones | grep 'Taipei'
Asia/Taipei

設定時區

# timedatectl set-timezone Asia/Taipei

驗證, CST 中原時區

# date
Thu Sep 10 23:34:18 CST 2015

服務上版時自動下載當日過版程式

將下列內容存成檔案, 並授予執行權限, 放置於 /usr/local/bin底下, 可以直接呼叫執行

#!/bin/bash
#
###########################################################
#                                                         #
#           長穩服務上版時自動下載當日過版程式            #
#                    V1.0.20210531                        #
#                        Aliok                            #
#                                                         #
###########################################################
#
if [ "$1" == "y" ]; then
  now="$(date -d 'yesterday' +'%y%m%d')"
  else now="$(date  +'%y%m%d')"
fi
echo "$now"
NAS="192.168.7.51"
workpath="$(pwd)"
svc=${workpath##*/}

## 下載資料夾(down load folder)判別目標資料夾是否存在, 存在則下載,不在則秀訊息 ##
function down_load_dir() {
       if [ -d $1 ];then
         continue
       else  scp -r sysbk@"$NAS":/volume1/IFSD/Release/$svc/$1 . && echo 下載$1
       fi
}

## 檢查當天日期現有資料夾名稱(check release),以下載最新的Release,避免重複下載 ##
function chk_release() {
local nas_dir=`ssh sysbk@"$NAS" 'ls /volume1/IFSD/Release/'$svc/`
for chk_today_dir in  $nas_dir
  do
    if [ -d `echo $chk_today_dir | grep $now` ]; then
      continue
      else down_load_dir  $chk_today_dir
    fi
  done
    echo "沒有新資料"
}


#判別所在位置是否為工作目錄(/var/icw),不正確則不執行
for chkdir in `ls /var/icw`
  do
    if [ /var/icw/$chkdir == $workpath ];
      then echo "現在工作目錄=>$chkdir"
          chk_release && exit 0
    fi
  done
echo 你的工作目錄不正確

[batch]定時將同步二個資料夾

這是利用windows的內建指令所撰寫的簡易同步範本
每60秒重複執行一次,若視窗被關閉則中斷

robocopy \\192.168.1.8\share\netpro\COE\TLC\transfer \\192.168.1.245\bi-coe\user\TLC\transfer /MIR
timeout /t 60
tlc.bat

將上面的內容存檔成tlc.bat, 在執行時它會自動再呼叫自己而徝環不斷

透過7zip進行資料夾的備份

可以進行全備份與差異備份, bat檔參考如下:

rem @echo off
if "%1"=="d" goto DIFF

:config
rem 設定備份來源資料夾
set srcfile=srcfile.txt
rem 設定備份目的位置
set DEST_DIR=Z:\backup
rem 設定備份檔名稱
set BKFN=tab
rem 設壓縮密碼
set passwd=abc123

:global
set ZOPT=-ssc -ssw -mhe=on -mx=9 -t7z
set nowMonth=%date:~5,2%
set nowDay=%date:~8,2%
set dt=%nowMonth%%nowDay%

:FULL
del %DEST_DIR%\%BKFN%*.7z
"C:\Program Files\7-Zip"\7z.exe  %ZOPT%  -p%passwd%  a %DEST_DIR%\%BKFN%.7z -i@%srcfile%
goto END

:DIFF
del %DEST_DIR%\%BKFN%_*_7.7z
rename %DEST_DIR%\%BKFN%_*_6.7z %BKFN%_*_7.7z
rename %DEST_DIR%\%BKFN%_*_5.7z %BKFN%_*_6.7z
rename %DEST_DIR%\%BKFN%_*_4.7z %BKFN%_*_5.7z
rename %DEST_DIR%\%BKFN%_*_3.7z %BKFN%_*_4.7z
rename %DEST_DIR%\%BKFN%_*_2.7z %BKFN%_*_3.7z
rename %DEST_DIR%\%BKFN%_*_1.7z %BKFN%_*_2.7z
"C:\Program Files\7-Zip"\7z.exe -p%passwd% u %DEST_DIR%\%BKFN%.7z -u- -up0q3r2x2y2z0w2!%DEST_DIR%\%BKFN%_%dt%_1.7z -i@%srcfile%

:END
rem echo on

[win10]如何查看NB的電池狀況

首先按下 Windows 下方的開始選單,在搜尋處輸入 CMD 開啟命令提示字元工具,並且輸入「powercfg/batteryreport」

powercfg/batteryreport


接著你的電池報告就完成啦!電池報告是以 html 檔呈現,儲存位置在 C:\User\UserName\battery-report.html,大家依照這個路徑就可以找到自己的電池報告啦!

程式過版用的遠端下載腳本

因為經常需要進行程式過版, 所以要從NAS中下載該服務的當日版號的release, 亦或者是當天修正的2版或3版(目前還沒看過當天4版), 所以在偷懶效率的前提下, 寫了一支script, 來加速作業並簡化指令。

#!/bin/bash
now="$(date +'%m%d')" #取得當天的日期
pah="$(pwd)" #所在位置字串
svc=${pah##*/} #所在位置取最後字串,即服務名稱

## 判別目標資料夾是否存在, 存在則下載,不在則秀訊息##
function ftpm() {
# 判別資料夾是否存在
if ssh sysbk@192.168.7.51 test -e   /volume1/IFSD/Release/"$svc"/v1.0.21"$now".$1;
#若存在則進行下載到本地工作目錄
then scp -r sysbk@192.168.7.51:/volume1/IFSD/Release/"$svc"/*.21"$now".$1/ .
else echo "不存在 v1.0.21$now.$1" #若不存在則回應訊息
fi
}

#判別當天日期有幾個資料夾,以上傳最新的Release,避免重複上傳已存在的
function dlfnas() {
if [ -d *.21"$now".4 ]; then ftpm 5  #判別本地工作目錄內第4版資料夾是否存在,若存在則下載第5版
elif [ -d *.21"$now".3 ]; then ftpm 4  #判別本地工作目錄內第3版資料夾是否存在,若存在則下載第4版
elif [ -d *.21"$now".2 ]; then ftpm 3  #判別本地工作目錄內第2版資料夾是否存在,若存在則下載第3版
elif [ -d *.21"$now".1 ]; then ftpm 2  #判別本地工作目錄內第1版資料夾是否存在,若存在則下載第2版
else ftpm 1  #下載第1版
fi
}

#判別所在位置是否為工作目錄(/var/icw),不正確則不執行
for chksvc in `ls /var/icw`
do
if [ $chksvc == $svc ];then
echo "現在執行=>$chksvc"
dlfnas
exit 0
fi
done
echo 你的工作目錄不正確

使用 OpenSSL 建立自簽憑證

使用 OpenSSL 建立自簽憑證

基本上按照下列步驟,就一定能建立出合法的自簽憑證:

  1. 建立 ssl.conf 設定檔
[req]
prompt = no
default_md = sha256
default_bits = 2048
distinguished_name = dn
x509_extensions = v3_req
​
[dn]
C = TW
ST = Taiwan
L = Taipei
O = iChainwin Inc.
OU = IFSD
emailAddress = lai@i-chainwin.com
CN = i-chainwin.com
​
[v3_req]
subjectAltName = @alt_names
​
[alt_names]
DNS.1 = *.i-chainwin.com
DNS.2 = i-chainwin.com
IP.1 = 192.168.2.100

上述設定檔內容的 [dn] 區段 (Distinguished Name) 為憑證的相關資訊,你可以自由調整為你想設定的內容,其中 O (Organization) 是公司名稱,OU (Organization Unit) 是部門名稱,而 CN (Common Name) 則是憑證名稱,你可以設定任意名稱,設定中文也可以,但請記得檔案要以 UTF-8 編碼存檔,且不能有 BOM 字元。設定檔的 [alt_names] 區段,則是用來設定 SSL 憑證的域名,這部分設定相當重要,如果沒有設定的話,許多瀏覽器都會將憑證視為無效憑證。這部分你要設定幾組域名都可以,基本上沒有什麼上限,因為自簽憑證主要目的是用來開發測試之用,因此建議可以把可能會用到的本機域名 (localhost) 或是區域網路的 IP 地址都加上去,以便後續進行遠端連線測試。如果你希望在 Google Chrome 瀏覽器也能瀏覽受信任的 SSL 網站,那麼設定正確的域名是非常重要的,這部分的相關知識我在 如何使用 PowerShell 建立開發測試用途的自簽憑證 (Self-Signed Certificate) 這篇文章中有完整說明。

2. 透過 OpenSSL 命令產生出自簽憑證與相對應的私密金鑰透過以下命令就可以建立出 私密金鑰 (server.key) 與 憑證檔案 (server.crt):openssl req -x509 -new -nodes -sha256 -utf8 -days 3650 -newkey rsa:2048 -keyout server.key -out server.crt -config ssl.conf請注意:上述命令會建立一個「未加密」的私密金鑰檔案,使用 PEM 格式輸出。

3. 透過 OpenSSL 命令產生 PKCS#12 憑證檔案 (*.pfx*.p12)如果你想將建立好的 私密金鑰 (server.key) 與 憑證檔案 (server.crt) 組合成一個 PFX 憑證檔案 (PKCS#12),可以透過以下命令產生 server.pfx 檔案。由於 *.pfx 格式的檔案必須設定一組密碼,因此在執行過程中會需要輸入密碼,用以保護這個 *.pfx 檔案。openssl pkcs12 -export -in server.crt -inkey server.key -out server.pfx

如此以來,你就擁有三個檔案,分別是:

  1. server.key (私密金鑰) (使用 PEM 格式) (無密碼保護)
  2. server.crt (憑證檔案) (使用 PEM 格式)
  3. server.pfx (PFX 檔案) (使用 PKCS#12 格式)※ 設定 IIS 網站繫結的時候,必須使用 PFX 格式的憑證檔案。

更換letsencrypt的捷徑

因為每次更新let’s encrypt的免費憑證時, 都會產出不同的名稱, 以避免重複, 但對應的捷徑又沒有自動修正, 只有手動自己調, 但每次要調就需要偷懶效率, 所以就寫了一個簡易的腳本來自動執行

#!/bin/bash
 cd /etc/letsencrypt/live/i-chainwin.com
 for loop in cert chain fullchain privkey  ; do
    rm -f "$loop".pem
    ln -s ../../archive/i-chainwin.com/"$loop"$1.pem "$loop".pem
 done

參數可代入這次要變更成為哪一個版數(1,2或3)

MariaDB的主從架構建置

Mariadb主從架構建置

一、資料庫安裝

  1. 至Mariadb官網下載安裝來源設定檔

  2. 將該檔上傳至主機

  3. 執行來源安裝檔


  4. 安裝mariadb-server

    yum install mariadb-server

  Erasing    : 1:mariadb-libs-5.5.64-1.el7.x86_64                                                                                                                                    14/14 
  Verifying  : MariaDB-server-10.4.13-1.el7.centos.x86_64                                                                                                                             1/14 
  Verifying  : MariaDB-compat-10.4.13-1.el7.centos.x86_64                                                                                                                             2/14 
  Verifying  : perl-Net-Daemon-0.48-5.el7.noarch                                                                                                                                      3/14 
  Verifying  : boost-program-options-1.53.0-28.el7.x86_64                                                                                                                             4/14 
  Verifying  : MariaDB-client-10.4.13-1.el7.centos.x86_64                                                                                                                             5/14 
  Verifying  : lsof-4.87-6.el7.x86_64                                                                                                                                                 6/14 
  Verifying  : MariaDB-common-10.4.13-1.el7.centos.x86_64                                                                                                                             7/14 
  Verifying  : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                                                                                            8/14 
  Verifying  : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                                                                                             9/14 
  Verifying  : perl-DBI-1.627-4.el7.x86_64                                                                                                                                           10/14 
  Verifying  : perl-IO-Compress-2.061-2.el7.noarch                                                                                                                                   11/14 
  Verifying  : perl-PlRPC-0.2020-14.el7.noarch                                                                                                                                       12/14 
  Verifying  : galera-4-26.4.4-1.rhel7.el7.centos.x86_64                                                                                                                             13/14 
  Verifying  : 1:mariadb-libs-5.5.64-1.el7.x86_64                                                                                                                                    14/14 

Installed:
  MariaDB-compat.x86_64 0:10.4.13-1.el7.centos                                                 MariaDB-server.x86_64 0:10.4.13-1.el7.centos                                                

Dependency Installed:
  MariaDB-client.x86_64 0:10.4.13-1.el7.centos  MariaDB-common.x86_64 0:10.4.13-1.el7.centos  boost-program-options.x86_64 0:1.53.0-28.el7  galera-4.x86_64 0:26.4.4-1.rhel7.el7.centos 
  lsof.x86_64 0:4.87-6.el7                      perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7  perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7   perl-DBI.x86_64 0:1.627-4.el7               
  perl-IO-Compress.noarch 0:2.061-2.el7         perl-Net-Daemon.noarch 0:0.48-5.el7           perl-PlRPC.noarch 0:0.2020-14.el7            

Replaced:
  mariadb-libs.x86_64 1:5.5.64-1.el7                                                                                                                                                       

Complete!

二、防火牆設定

  1. 新增3306port 的服務

    firewall-cmd --add-port=3306/tcp --perm
  2. 重啟防火牆

    firewall-cmd --reload

三、主資料庫設定

  1. 啟用Mariadb

    #systemctl enable mariadb
    Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
    Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
    Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
    
    #systemctl start mariadb
  2. 建立root密碼或變更管理者密碼 1或2任選一個

    1.mysql_secure_installation
    過程說明:
    輸入root密碼,預設為空
    設定root密碼[Y/n]?不要為了方便跟OS的root相同…
    移除匿名使用者[Y/n]?Y
    是否禁止root遠端登入[Y/n]?Y,建議禁止
    刪除測試用資料[Y/n]?Y
    重新載入權限[Y/n]?Y
    
    2.mysqladmin -u root password

  3. 修改/etc/my.cnf

    #vi /etc/my.cnf

    加入以下設定

    [mysqld]
    server-id=1
    log_bin=master-bin
    binlog-ignore-db=mysql
    binlog-ignore-db=information_schema
    binlog-ignore-db=performance_schema
    binlog-ignore-db=test
    innodb_flush_log_at_trx_commit=1
    binlog_format=mixed

    備註:此配置一定要在[mysqld]之下

    重啟服務

    #systemctl restart mariadb
  4. 新增備份帳號 登入mariadb

    #mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 10
    Server version: 10.4.13-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> 

    新增備份帳號bkuser

    MariaDB [(none)]>grant replication slave on *.* to 'bkuser'@'%' identified by '123456';
    Query OK, 0 rows affected (0.005 sec)
  5. 秀出master現況

    MariaDB [(none)]>show master status\G
    *************************** 1. row ***************************
                File: master-bin.000001
            Position: 329
        Binlog_Do_DB: 
    Binlog_Ignore_DB: mysql,information_schema,performance_schema,test
    1 row in set (0.001 sec)

四、從資料庫設定

  1. 前面一、二、三、1.2.都依照前面所述 ,依樣畫葫蘆

  2. 修改/etc/my.cnf

    [mysqld]
    server-id=2
    relay-log-index=slave-relay-bin.index
    relay-log=slave-relay-bin
    relay_log_recovery=1

    重啟mariadb

    #systemctl restart mariadb
  3. 設定同步主資料庫 進入mysql

    #mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 10
    Server version: 10.4.13-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> 

    先停用slave

    MariaDB [(none)]>stop slave;

    設定同步主資料庫資訊

    MariaDB [(none)]>change master to 
                     master_host='192.168.7.132',        <-master資料庫主機IP
                     master_user='bkuser',               <-前面三4設定的備份帳號
                     master_password='123456',           <-前面三4設定的備份帳號密碼
                     master_log_file='master-bin.000001',<-前面三5所查出的檔名編號
                     master_log_pos=329;                 <-前面三5所查出的LOG編號

    啟用slave

    MariaDB [(none)]>start slave;
  4. 秀出slave現況

    MariaDB [(none)]> show slave status\G
    *************************** 1. row ***************************
                    Slave_IO_State: Waiting for master to send event
                       Master_Host: 192.168.7.132
                       Master_User: bkuser
                       Master_Port: 3306
                     Connect_Retry: 60
                   Master_Log_File: master-bin.000001
               Read_Master_Log_Pos: 329
                    Relay_Log_File: slave-relay-bin.000004
                     Relay_Log_Pos: 556
             Relay_Master_Log_File: master-bin.000001
                  Slave_IO_Running: Yes
                 Slave_SQL_Running: Yes
                   Replicate_Do_DB: 
               Replicate_Ignore_DB: 
                Replicate_Do_Table: 
            Replicate_Ignore_Table: 
           Replicate_Wild_Do_Table: 
       Replicate_Wild_Ignore_Table: 
                        Last_Errno: 0
                        Last_Error: 
                      Skip_Counter: 0
               Exec_Master_Log_Pos: 329
                   Relay_Log_Space: 865
                   Until_Condition: None
                    Until_Log_File: 
                     Until_Log_Pos: 0
                Master_SSL_Allowed: No
                Master_SSL_CA_File: 
                Master_SSL_CA_Path: 
                   Master_SSL_Cert: 
                 Master_SSL_Cipher: 
                    Master_SSL_Key: 
             Seconds_Behind_Master: 0
     Master_SSL_Verify_Server_Cert: No
                     Last_IO_Errno: 0
                     Last_IO_Error: 
                    Last_SQL_Errno: 0
                    Last_SQL_Error: 
       Replicate_Ignore_Server_Ids: 
                  Master_Server_Id: 1
                    Master_SSL_Crl: 
                Master_SSL_Crlpath: 
                        Using_Gtid: No
                       Gtid_IO_Pos: 
           Replicate_Do_Domain_Ids: 
       Replicate_Ignore_Domain_Ids: 
                     Parallel_Mode: conservative
                         SQL_Delay: 0
               SQL_Remaining_Delay: NULL
           Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
                  Slave_DDL_Groups: 0
    Slave_Non_Transactional_Groups: 0
        Slave_Transactional_Groups: 0
    1 row in set (0.001 sec)
    

    看到紅框的部份都出現Yes , 表示已經連上master,並且開始同步

五、驗證

  1. 於master新增資料庫及資料 登入master

    #mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 10
    Server version: 10.4.13-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]>

    新增一個資料庫

    MariaDB [(none)]>CREATE DATABASE ICW01;
    Query OK, 1 row affected (0.002 sec)

    進入ICW01後再新增一個資料表

    MariaDB [(none)]> USE ICW01;
    Database changed
    MariaDB [ICW01]> CREATE TABLE my_table ( data  varchar(255))
        -> ENGINE=InnoDB DEFAULT CHARSET=utf8;
    Query OK, 0 rows affected (0.027 sec)

    再新增一筆資料備查

    MariaDB [ICW01]> INSERT INTO my_table (data) VALUES ('I will be  successful!');
    Query OK, 1 row affected (0.006 sec)

    再秀一下master狀態

    MariaDB [ICW01]> show master status\G
    *************************** 1. row ***************************
                File: master-bin.000001
            Position: 850
        Binlog_Do_DB: 
    Binlog_Ignore_DB: mysql,information_schema,performance_schema,test
    1 row in set (0.001 sec)

    發現LOG已經增加為850

  2. 於slave去查詢master所新增的資料 登入slave

    #mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 10
    Server version: 10.4.13-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]>

    秀slave狀態

    MariaDB [(none)]> show slave status\G
    *************************** 1. row ***************************
                    Slave_IO_State: Waiting for master to send event
                       Master_Host: 192.168.7.132
                       Master_User: bkuser
                       Master_Port: 3306
                     Connect_Retry: 60
                   Master_Log_File: master-bin.000001
               Read_Master_Log_Pos: 850
                    Relay_Log_File: slave-relay-bin.000004
                     Relay_Log_Pos: 1077
             Relay_Master_Log_File: master-bin.000001
                  Slave_IO_Running: Yes
                 Slave_SQL_Running: Yes

    發現它已經自動同步到850

    再秀一下現有的資料庫

    MariaDB [(none)]> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | ICW01              |
    | information_schema |
    | mysql              |
    | performance_schema |
    | test               |
    +--------------------+
    5 rows in set (0.002 sec)

    發現ICW01 已經出現在資料庫列表之中

    再去查詢裡面的資料是否正確

    MariaDB [(none)]> use ICW01;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Database changed
    MariaDB [ICW01]> select * from my_table;
    +------------------------+
    | data                   |
    +------------------------+
    | I will be  successful! |
    +------------------------+
    1 row in set (0.001 sec)

    確認正確 !!

轉移bugtracker至office

因為要節省AWS的費用成本, 要把DMZ主機bugtracker轉移回office的VM中

1.重裝一個CentOS 7
2.安裝httpd, mariadb-server, php, epel-release,phpmyadmin
3.將原主機的DB Dump出來 mysqldump -u root -p bugdb > bugdb.sql
4.將web 用tar 備出來  tar czvf web.tar.gz  /var/www/html
5.把二個備份檔傳到新主機
6.解開web => tar zxvf web.tar.gz -C /
7.透過phpmyadmin把DB備份滙入
8.完成收工

當然過程中還有一些要做小小的修正

例如phpmyadmin, 要去/etc/httpd/conf.d/phpMyadmin.conf 做修改

<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip 192.168.0.0/16
Require ip ::1
</RequireAny>
</IfModule>

加上192.168.0.0/16的網段, 才能在內網開啟, 否則無法連到服務

還有就是上傳DB備份檔時, 檔案大於2M, 因此會失敗, 需要修改預設值

還要設定 php.ini  位置在/etc/php.ini,請編輯

找到 post_max_size = 8M(你的伺服器可能是其他數值)

改成 post_max_size = 32M

再找到 upload_max_filesize = 2M(你的伺服器可能是其他數值)

改成 upload_max_filesize = 32M

存檔離開

如此才能正確的滙入舊資料