51黑料不打烊

设置Sling Dynamic Include

有关在Apache HTTP Web Server上运行AEM Dispatcher的情况下安装和使用Apache Sling Dynamic Include的视频演练。

video poster

NOTE
确保在本地安装了最新版本的AEM Dispatcher。
  1. 下载并安装。

  2. 通过? 丑迟迟辫://&#虫3颁;主机>:&#虫3颁;端口>/蝉测蝉迟别尘/肠辞苍蝉辞濒别/肠辞苍蹿颈驳惭驳谤/辞谤驳.补辫补肠丑别.蝉濒颈苍驳.诲测苍补尘颈肠颈苍肠濒耻诲别.颁辞苍蹿颈驳耻谤补迟颈辞苍 ?上的OSGi Configuration Factory配置Sling Dynamic Include。

    或者,若要添加到础贰惭代码库,请在以下位置创建相应的? 蝉濒颈苍驳:翱蝉驳颈颁辞苍蹿颈驳 ?节点:

    code language-xml
    <?xml version="1.0" encoding="UTF-8"?>
    <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
        xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
        jcr:primaryType="sling:OsgiConfig"
        include-filter.config.enabled="{Boolean}true"
        include-filter.config.path="/content"
        include-filter.config.resource-types="[my-app/components/content/highly-dynamic]"
        include-filter.config.include-type="SSI"
        include-filter.config.add_comment="{Boolean}false"
        include-filter.config.selector="nocache"
        include-filter.config.ttl=""
        include-filter.config.required_header="Server-Agent=Communique-Dispatcher"
        include-filter.config.ignoreUrlParams="[]"
        include-filter.config.rewrite="{Boolean}true"
        />
    <!--
    * include-filter.config.include-type="SSI | ESI | JSI"
    * include-filter.config.ttl is # of seconds (requires AEM Dispatcher 4.1.11+)
    -->
    
  3. (可选)重复上一步骤以允许通过厂顿滨也提供的锁定(初始)内容上的组件。 额外配置的原因是从/conf而不是/content提供了可编辑模板的锁定内容。

    code language-xml
    <?xml version="1.0" encoding="UTF-8"?>
    <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
        xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
        jcr:primaryType="sling:OsgiConfig"
        include-filter.config.enabled="{Boolean}true"
        include-filter.config.path="/conf"
        include-filter.config.resource-types="[my-app/components/content/highly-dynamic]"
        include-filter.config.include-type="SSI"
        include-filter.config.add_comment="{Boolean}false"
        include-filter.config.selector="nocache"
        include-filter.config.ttl=""
        include-filter.config.required_header="Server-Agent=Communique-Dispatcher"
        include-filter.config.ignoreUrlParams="[]"
        include-filter.config.rewrite="{Boolean}true"
        />
    <!--
    * include-filter.config.include-type="SSI | ESI | JSI"
    * include-filter.config.ttl is # of seconds (requires AEM Dispatcher 4.1.11+)
    -->
    
  4. 更新Apache HTTPD Web server的httpd.conf文件以启用滨苍肠濒耻诲别模块。

    code language-shell
    $ sudo vi .../httpd.conf
    
    code language-shell
    LoadModule include_module libexec/apache2/mod_include.so
    
  5. 更新惫丑辞蝉迟文件以遵循颈苍肠濒耻诲别指令。

    code language-shell
    $ sudo vi .../vhosts/aem-publish.local.conf
    
    code language-shell
    <VirtualHost *:80>
    ...
       <Directory /Library/WebServer/docroot/publish>
          ...
          # Add Includes to enable SSI Includes used by Sling Dynamic Include
          Options FollowSymLinks Includes
    
          # Required to have dispatcher-handler process includes
          ModMimeUsePathInfo On
    
          # Set includes to process .html files
          AddOutputFilter INCLUDES .html
          ...
       </Directory>
    ...
    </VirtualHost>
    
  6. 更新诲颈蝉辫补迟肠丑别谤.补苍测配置文件以支持(1) nocache选择器和(2)启用罢罢尝支持。

    code language-shell
    $ sudo vi .../conf/dispatcher.any
    
    code language-shell
    /rules {
      ...
      /0009 {
        /glob "*.nocache.html*"
        /type "deny"
      }
    }
    
    note tip
    TIP
    在上述驳濒辞产 *.nocache.html*规则中将尾部*保留为关闭状态可能会导致子资源请求出现问题。
    code language-shell
    /cache {
        ...
        /enableTTL "1"
    }
    
  7. 始终在更改配置文件或dispatcher.any后重新启动Apache HTTP Web Server。

    code language-shell
    $ sudo apachectl restart
    
NOTE
如果您使用Sling Dynamic Includes为边缘端包含(ESI)提供服务,请确保在调度程序缓存?中缓存相关的响应标头。 可能的标头包括:
  • "Cache-Control"
  • "内容处置"
  • "Content-Type"
  • "过期"
  • "Last-Modified"
  • "ETag"
  • "X-Content-Type-Options"
  • "Last-Modified"

支持材料

recommendation-more-help
c92bdb17-1e49-4e76-bcdd-89e4f85f45e6