1. CDNの有効化

CDNを使用するようにSitecore Media Libraryを手動で設定する

Version:
日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

このトピックでは、Sitecore Media Libraryを手動で設定してMicrosoft Azure® Content Delivery Network (CDN) を使用できるようにする方法について説明します。これは、オンプレミスまたはAzureにデプロイされた既存のSitecoreインスタンスがあり、Sitecore Media LibraryでCDNを使用できるようにする場合に便利です。

メモ

Sitecore XMの新しいインスタンスまたはAzureにXP scaled設定をデプロイする場合は、手動で設定する必要はありません。代わりに、次のいずれかのオプションを使用できます。

前提 条件

Sitecore Media LibraryでCDNを使用するように設定する前に、次のことを行う必要があります。

Sitecore Media Libraryを手動で設定する

Sitecore Media Libraryを手動で設定して、CDNを使用できるようにします。

  1. Sitecore Content Delivery (CD) サーバーで、Sitecore deploymentフォルダーに移動します。

  2. App_Config\Includeで、CDNという名前のフォルダを作成します。

  3. CDNフォルダにファイルを作成し、次の名前を付けます。CDN.config

  4. CDN.configファイルを編集し、次の情報をファイルに保存します。

    手記

    http://example.comの代わりに、CDNエンドポイントのURLを使用します。

    <?xml version="1.0" encoding="utf-8"?>
    
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
    
        <sitecore>
    
            <settings>
    
                <!--  
    
                     
    MediaResponse.AlwaysIncludeServerUrl must be true, to always include CDN
    url when getting media item url.
    
                      Otherwise, the request will
    not be served by CDN server.
    
                -->
    
                <setting name="Media.AlwaysIncludeServerUrl">
    
                    <patch:attribute name="value">true</patch:attribute>
    
                </setting>
    
                <!--  
    
                     
    MediaResponse.MediaLinkServerUrl must be set to url of the CDN endpoint.
    
                      Change it from http://example.com, to the url of the CDN
    endpoint.
    
                -->
    
                <setting name="Media.MediaLinkServerUrl">
    
                    <patch:attribute name="value">http://example.com</patch:attribute>
    
                </setting>
    
                <!--  
    
                     
    MediaResponse.AlwaysAppendRevision should be true to always append
    revision when getting media item url.
    
                      The purpose of the value is
    to generate a unique URL for every revision.
    
                -->            
    
                <setting name="Media.AlwaysAppendRevision">
    
                    <patch:attribute name="value">true</patch:attribute>
    
                </setting>
    
                <!--  
    
                      MediaResponse.Cacheability
    must be Public to let the CDN server cache the response.
    
                      Otherwise instead of caching
    the response, the CDN server will ask for the response from Sitecore server
    every time. 
    
                -->
    
                <setting name="MediaResponse.Cacheability">
    
                    <patch:attribute name="value">Public</patch:attribute>
    
                </setting>
    
                <!--  
    
                     The max-age to use in media
    response headers.
    
                     CDN server uses this value as
    max-age of the response cache.
    
                -->
    
                <setting name="MediaResponse.MaxAge">
    
                    <patch:attribute name="value">7.00:00:00</patch:attribute>
    
                </setting>
    
            </settings>
    
        </sitecore>
    
    </configuration>
    手記

    この例の設定ファイルは、のルートSitecoreフォルダApp_Config\Include\Examples\CDN.config.exampleにもあります。

    設定値の詳細については、「 Sitecore Media Library CDN関連の設定リファレンス」を参照してください。

  5. 「Sitecore Media Library CDNサポートの開発者向け考慮事項」のGetting a CDN-enabled Media Item URLセクションに記載されているオプションのいずれかを使用して作成されたURLに、CDN URLとリビジョン番号が含まれていることを確認します。

この記事を改善するための提案がある場合は、 お知らせください!