主機描述檔可以 YAML 或 JSON 格式寫入,包含一系列要從原始伺服器遷移的客戶、訂閱、附加域名、郵箱等。您可以在 此處 找到主機描述檔樣本。本主題主要闡述如何配置一系列可保障成功遷移的常用參數。

指定網站內容資料的路徑

若要指定原始伺服器和目的伺服器上的網站內容資料的路徑,請在訂閱部分中使用以下參數:

  • source_webspace_root - 包含客戶在原始伺服器上所有可用的檔的目錄的絕對路徑。只能在訂閱級別指定(例如, /home/vhosts/example.com )。
  • source_document_root - 只包含 HTTP 協定所服務的檔的目錄的絕對路徑。可在訂閱、附加域名或子域名級別指定(例如, /home/vhosts/example.com/httpdocs )。
  • target_document_root - 將包含目的伺服器上由 HTTP 協定所服務的檔的目錄。該路徑是與目的伺服器上訂閱根目錄相對的。可在訂閱、附加域名或子域名級別指定(例如, data/www 。如果域名為 example.com ,而 Plesk 中的虛擬主機目錄是 /var/www/vhosts ,那麼目的伺服器上文檔根目錄的絕對路徑將是 /var/www/vhosts/example.com/data/www )。如未指定,將會使用 Plesk 預設值。

備註: 如果設定檔不包含原始伺服器的存取資訊, source_webspace_rootsource_document_root 路徑將被視作目的伺服器上的本地路徑。

如果您需要阻止遷移某個目錄或檔,請使用 exclude 指令和 source_webspace_root 以及 source_document_root 參數。例如:

subscriptions:
  - name: example.com
    source_webspace_root:
      path: /home/vhosts/example.com
      exclude:
        - /bin
        - /logs

寫入 exclude 規則的句法與 rsync 工具所使用的相同。請參閱 rsync 文檔 - 查看 Include/Exclude 模式規則 不符瞭解詳情。

如果您需要對將原始伺服器上指定目錄的網站內容放置在目的伺服器上哪個目錄進行確切指定,請使用網站檔映射。例如:

subscriptions:
  - name: example.com
    target_document_root: data/www
    web_files:
      - source: /home/vhosts/example.com
        target: "{webspace_root}"
      - source: /home/vhosts/example.com/httpdocs
        target: "{document_root}"

目標指令用於指定目的伺服器上的絕對路徑,或包含一個或多個來自以下表格的範本變數的格式字串。

範本變數和訂閱的含義 - 例如,當 web_files 節點直接在一個訂閱節點下:

Template variable Details Applicable to
{anon_ftp_incoming} 可用於通過匿名 FTP 上傳的目錄路徑 僅限 Linux
{anon_ftp_pub} 可用於通過匿名 FTP 讀取的目錄路徑 僅限 Linux
{cgi_bin} 訂閱的 cgi-bin 目錄路徑 僅限於 Unix
{document_root} 訂閱的文檔根目錄路徑 - 可用於 HTTP 協定的目錄 Linux 和 Windows
{logs} 帶有日誌的目錄路徑(Apache 存取和錯誤日誌,等等) Linux 和 Windows
{main_domain_private} 主域名的私有目錄 僅限 Windows
{main_domain_statistics} 主域名的統計目錄 (AWStats/Webalizer/etc) 僅限 Windows
{protected_dirs} 帶有受保護目錄的設定的目錄路徑 僅限 Linux
{ssl_document_root} 訂閱的安全文檔根目錄路徑 - 可用於 HTTPS 協定的目錄 僅限 Windows
{statistics} 帶有統計檔的目錄路徑 (AWStats/Webalizer/etc) 僅限 Linux
{webspace_idn} 以 punycode 編碼的訂閱名稱 Linux 和 Windows
{webspace_root} 訂閱根目錄的路徑 Linux 和 Windows
{webspace} 訂閱名稱 Linux 和 Windows

範本變數與附加域名和子域名的含義 - 例如,當 web_files 節點直接在一個附加域名或子域名節點下:

Template variable Details Applicable to
{cgi_bin} 附加域名/子域名的 cgi-bin 目錄路徑 僅限 Linux
{document_root} 附加域名/子域名的文檔根目錄路徑 Linux 和 Windows
{logs} 帶有附加域名/子域名的日誌的目錄路徑(Apache 存取和錯誤日誌,等等) 僅限 Linux
{protected_dirs} 帶有附加域名/子域名受保護目錄的設定的目錄路徑 僅限 Linux
{site_idn} 以 punycode 編碼的附加域名/子域名的名稱 Linux 和 Windows
{site} 附加域名/子域名的名稱 Linux 和 Windows
{statistics} 帶有附加域名/子域名統計檔的目錄路徑 (AWStats/Webalizer/etc) Linux 和 Windows
{webspace_anon_ftp_incoming} 可用于通過父級訂閱匿名 FTP 上傳的目錄路徑 僅限 Linux
{webspace_anon_ftp_pub} 可用于通過父級訂閱匿名 FTP 讀取的目錄路徑 僅限 Linux
{webspace_cgi_bin} 父級訂閱的 cgi-bin 目錄路徑 僅限 Linux
{webspace_document_root} 父級訂閱文檔根目錄的路徑 Linux 和 Windows
{webspace_idn} 以 punycode 編碼的父級訂閱名稱 Linux 和 Windows
{webspace_logs} 帶有父級訂閱日誌的目錄路徑(Apache 存取和錯誤日誌,等等) Linux 和 Windows
{webspace_protected_dirs} 帶有父級訂閱受保護目錄的設定的目錄路徑 僅限 Linux
{webspace_root} 訂閱根目錄的路徑 Linux 和 Windows
{webspace_ssl_document_root} 父級訂閱的安全文檔根目錄路徑 - 可用於 HTTPS 協定的目錄 僅限 Windows
{webspace_statistics} 帶有父級訂閱統計檔的目錄路徑 (AWStats/Webalizer/etc) 僅限 Linux
{webspace} 父級訂閱名稱 Linux 和 Windows

指定郵件內容資料的路徑

從原始伺服器遷移郵件內容到目的伺服器的流程機制在 Linux 和 Windows 系統上不同。

在 Linux 系統上,您需要在 mail_users 部分指定有關要遷移的郵箱的資訊:

mail_users:
- name: johndoe
  password: 123qwe
  directory: /var/qmail/mailnames/johndoe

其中」directory」 會指定在原始伺服器上存儲郵箱內容的絕對路徑,或手動移向目的伺服器後將其放置哪裡。

在 Windows 系統上,無需在主機描述檔中指定任何資訊。所有郵件內容都將使用 Plesk 備份和恢復機制進行遷移。

備註: 在 Windows 上,Plesk Migrator 沒有導入手動移向目的伺服器的郵件內容的功能。若要遷移郵件內容,必須要存取原始伺服器。

指定資料庫的路徑

當從其它面板遷移時,Plesk Migrator 能夠複製 MySQL 和 Microsoft SQL 伺服器資料庫。有兩種複製資料庫內容的方式:

  • 如果允許存取資料庫伺服器,則可以直接複製內容。
  • 從資料庫轉儲檔案修復內容。

若要直接從資料庫伺服器複製內容,該資料庫伺服器必須列舉於 Plesk Migrator 設定檔中,且必須提供伺服器的存取資訊。在 資料庫 部分使用 伺服器 參數:

databases:
  - server: mysql-db
    name: wordpress_9
    users:
    - login: exdbuser1
      password: 123qwe
  - server: mssql-db
    name: drupal_2
    users:
    - login: exdbuser2
      password: 123qwe

or

- name: wordpress_9
  dump: wordpress_9.sql
  users:
    - login: exdbuser1

轉儲檔必須以指定格式創建的才能從該轉儲檔案修復內容:

  • 對於 MySQL,可通過 mysqldump 等工具進行創建。
  • 對於 Microsoft SQL 伺服器,請使用 T-SQL 結構 「BACKUP」.

若要恢復轉儲,請指定 dump 選項,如下:

- name: wordpress_9
  dump: wordpress_9.sql
  user:
    login: exdbuser1

備註: 只有原始伺服器上的 Microsoft SQL 伺服器實例的主機名稱能夠在目的伺服器上解析才能遷移 Microsoft SQL 伺服器資料庫。