雲端中的 Dispatcher Dispatcher-in-the-cloud

簡介 apache-and-dispatcher-configuration-and-testing

本頁說明Dispatcher工具,以及如何下載及解壓縮這些工具,列出支援的Apache模組,並提供舊版和彈性模式的高層級概觀。 此外,也提供驗證、偵錯和將Dispatcher設定從AMS移轉至AEM as a Cloud Service的相關參考資料。

Dispatcher 工具 dispatcher-sdk

Dispatcher 工具是整體 AEM as a Cloud Service SDK 的一部分,提供:

  • 一種標準檔案結構,包含要包含在Dispatcher的maven專案中的組態檔案。
  • 若要驗證Dispatcher設定是否只包含AEM as a Cloud Service支援的指令,請使用此工具。 此外,工具會驗證語法是否正確,以便Apache能夠成功啟動。
  • 在本機啟動Dispatcher的Docker映像。

下載並解壓縮工具 extracting-the-sdk

Dispatcher 工具是 AEM as a Cloud Service SDK 的一部分,可以在 Software Distribution 入口網站下載其壓縮檔。 該新的 Dispatcher 工具版本中可用的任何新設定都可用於部署到特定雲端環境,此環境在雲端執行該 AEM 版本或更高版本。

解壓縮 SDK,其包含適用於 macOS、Linux® 和 Windows 的 Dispatcher 工具。

對於 macOS/Linux,使 Dispatcher 工具成品可執行並執行它。 它會將Dispatcher Tools檔案擷取到您儲存它們的目錄中(其中version是Dispatcher Tools的版本)。

$ chmod +x aem-sdk-dispatcher-tools-<version>-unix.sh
$ ./aem-sdk-dispatcher-tools-<version>-unix.sh
Verifying archive integrity...  100%   All good.
Uncompressing aem-sdk-dispatcher-tools-<version>-unix.sh 100%

對於 Windows,擷取 Dispatcher Tooling zip 封存。

使用 Dispatcher 工具進行驗證和偵錯 validation-debug

Dispatcher 工具用於驗證和偵錯專案的 Dispatcher 設定。 根據專案的 Dispatcher 設定是以靈活模式還是傳統模式建構的,在下面參考的頁面中進一步了解如何使用這些工具:

  • 彈性模式 — 建議模式,以及AEM archetype 28和更新版本的預設值,Cloud Manager也會將這些模式用於Cloud Manager 2021.7.0版本之後建立的新環境。 客戶可以透過新增資料夾和檔案 opt-in/USE_SOURCES_DIRECTLY 來啟動此模式。 有了這個更具彈性的模式,在舊版模式中,需要單一rewrite.rules檔案的rewrites資料夾底下的檔案結構沒有限制。 此外,可以新增的規則數量也沒有限制。 如需資料夾結構和本機驗證的詳細資訊,請參閱使用 Dispatcher 工具進行驗證和偵錯。

  • 舊版模式 — 如需Dispatcher設定舊版模式的資料夾結構和本機驗證的詳細資訊,請參閱使用Dispatcher工具進行驗證和偵錯(舊版)

如需有關如何從舊版組態模式移轉到更靈活模式(隨AEM原型28及更高版本提供)的詳細資訊,請參閱本檔案。

內容處置 content-disposition

對於發佈層級,提供 Blob 的預設方式是作為附件。 使用 Dispatcher 中的標準內容處置標頭覆寫此設定。

以下是設定的外觀範例:

<LocationMatch "^\/content\/dam.*\.(pdf).*">
 Header unset Content-Disposition
 Header set Content-Disposition inline
</LocationMatch>

支援的 Apache 模組 supported-directives

下表顯示了支援的 Apache 模組:

模組名稱
參考頁面
core
https://httpd.apache.org/docs/2.4/mod/core.html
mod_access_compat
https://httpd.apache.org/docs/2.4/mod/mod_access_compat.html
mod_alias
https://httpd.apache.org/docs/2.4/mod/mod_alias.html
mod_allowmethods
https://httpd.apache.org/docs/2.4/mod/mod_allowmethods.html
mod_authn_core
https://httpd.apache.org/docs/2.4/mod/mod_authn_core.html
mod_authn_file
https://httpd.apache.org/docs/2.4/mod/core.html
mod_authz_core
https://httpd.apache.org/docs/2.4/mod/core.html
mod_authz_groupfile
https://httpd.apache.org/docs/2.4/mod/mod_authz_groupfile.html
mod_deflate
https://httpd.apache.org/docs/2.4/mod/mod_deflate.html
mod_dir
https://httpd.apache.org/docs/2.4/mod/mod_dir.html
mod_env
https://httpd.apache.org/docs/2.4/mod/mod_env.html
mod_filter
https://httpd.apache.org/docs/2.4/mod/mod_filter.html
mod_headers
https://httpd.apache.org/docs/2.4/mod/mod_headers.html
mod_mime
https://httpd.apache.org/docs/2.4/mod/mod_mime.html
mod_proxy
https://httpd.apache.org/docs/2.4/mod/mod_proxy.html
mod_proxy_http
https://httpd.apache.org/docs/2.4/mod/mod_proxy_http.html
mod_remoteip
https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html
mod_reqtimeout
https://httpd.apache.org/docs/2.4/mod/mod_reqtimeout.html
mod_rewrite
https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html
mod_security
https://modsecurity.org/
mod_setenvif
https://httpd.apache.org/docs/2.4/mod/mod_setenvif.html
mod_ssl (only the SSLProxyEngine directive)
https://httpd.apache.org/docs/2.4/mod/mod_ssl.html#sslproxyengine
mod_substitute
https://httpd.apache.org/docs/2.4/mod/mod_substitute.html
mod_userdir
https://httpd.apache.org/docs/2.4/mod/mod_userdir.html
mod_macro
https://httpd.apache.org/docs/2.4/mod/mod_macro.html
mod_include (no directives supported)
https://httpd.apache.org/docs/2.4/mod/mod_include.html

客戶無法新增任意模組,但會考慮在未來納入其他模組。 客戶可以在SDK中執行驗證器的允許清單命令,以找到特定Dispatcher版本可用的指令清單。

執行驗證器的加入允許清單命令,可以列出允許用於 Apache 設定檔案的指示詞:

$ validator allowlist
Cloud manager validator 2.0.4

Allowlisted directives:
  <Directory>
  ...

資料夾結構 folder-structure

專案的Apache和Dispatcher資料夾結構會因專案使用的模式而稍微不同,如上面使用Dispatcher工具🔗進行的驗證和偵錯一節所述。

部署Dispatcher設定 deploy-dispatcher-configurations

Cloud Manager會透過完整棧疊管道或Web層設定管道來部署您的Dispatcher設定。 Web層設定管道僅部署Dispatcher設定。

當您設定Web層設定管道時,請將​ 代碼位置 ​設定到包含conf.d、conf.dispatcher.d和opt-in目錄的資料夾。 對於從具有未修改結構的AEM專案原型產生的專案,此資料夾為/dispatcher/src。

IMPORTANT
如果​ 代碼位置 ​為/,且您的Dispatcher設定位於子資料夾中,則管道找不到opt-in/USE_SOURCES_DIRECTLY檔案並失敗。

如需設定這些管道的步驟,請參閱新增生產管道和新增非生產管道。 如需有關Web層設定管道的詳細資訊,請參閱CI/CD管道。

從 AMS 移轉 Dispatcher 設定 ams-aem

如需有關如何將 Dispatcher 設定從 AMS 移轉到 AEM as a Cloud Service 的詳細資訊,請參閱將 Dispatcher 設定從 AMS 移轉到 AEM as a Cloud Service 頁面。

recommendation-more-help
experience-manager-cloud-service-help-main-toc