開始使用 Azure CDNGetting started with Azure CDN

本文說明如何藉由建立新的 CDN 設定檔和端點來啟用 Azure CDN。This article describes how to enable Azure CDN by creating a new CDN profile and endpoint.

重要

如需 CDN 簡介和功能清單,請參閱 CDN 概觀For an introduction to CDN and a list of features, see CDN Overview.

建立新的 CDN 設定檔Create a new CDN profile

CDN 設定檔就是 CDN 端點的集合。A CDN profile is a collection of CDN endpoints. 每個設定檔皆包含一或多個 CDN 端點。Each profile contains one or more CDN endpoints. 您可能會想要使用多個設定檔,依網際網路網域、Web 應用程式或其他準則來組織您的 CDN 端點。You may wish to use multiple profiles to organize your CDN endpoints by internet domain, web application, or some other criteria.

注意

Azure 訂用帳戶對下列資源具有預設限制:An Azure subscription has default limits for the following resources:

  • 可建立的 CDN 設定檔數目The number of CDN profiles that can be created
  • 可在 CDN 設定檔中建立的端點數目The number of endpoints that can be created in a CDN profile
  • 可對應至端點的自訂網域數目The number of custom domains that can be mapped to an endpoint

如需 CDN 訂用帳戶限制的相關資訊,請參閱 CDN 限制For information about CDN subscription limits, see CDN limits.

CDN 定價是根據 CDN 設定檔層級來套用的。CDN pricing is applied at the CDN profile level. 如果您想要混合使用 Azure CDN 定價層,您需要擁有多個 CDN 設定檔。If you wish to use a mix of Azure CDN pricing tiers, you will need multiple CDN profiles.

建立新的 CDN 設定檔To create a new CDN profile

  1. Azure 入口網站的左上角,按一下 [新增]。In the Azure Portal, in the upper left, click New. 在 [新增] 刀鋒視窗中,依序選取 [Web + 行動] 和 [CDN]。In the New blade, select Web + Mobile, then CDN.

    此時會顯示新的 [CDN 設定檔] 刀鋒視窗。The new CDN profile blade appears.

    新增 CDN 設定檔

  2. 輸入 CDN 設定檔的名稱。Enter a name for your CDN profile.
  3. 選取 [位置] 。Select a Location. 此為儲存您 CDN 設定檔資訊的所在 Azure 位置。This is the Azure location where your CDN profile information will be stored. 其不會影響 CDN 端點位置。It has no impact on CDN endpoint locations.
  4. 選取或建立 資源群組Select or create a Resource Group. 如需資源群組的詳細資訊,請參閱 Azure Resource Manager 概觀For more information on Resource Groups, see Azure Resource Manager overview.
  5. 選取 定價層Select a Pricing tier. 如需定價層的比較,請參閱 CDN 概觀See the CDN Overview for a comparison of pricing tiers.

    CDN 定價層選取項目

  6. 選取這個 CDN 設定檔的 [訂用帳戶] 。Select the Subscription for this CDN profile.
  7. 按一下 [建立] 按鈕,以建立新的設定檔。Click the Create button to create the new profile.

建立新的 CDN 端點Create a new CDN endpoint

建立新的 CDN 端點To create a new CDN endpoint

  1. Azure 入口網站中,瀏覽到您的 CDN 設定檔。In the Azure portal, navigate to your CDN profile. 您可能已在先前步驟中將其釘選至儀表板。You may have pinned it to the dashboard in the previous step. 若否,則您可依序按一下 [瀏覽]、[CDN 設定檔] 尋找該設定檔,然後再按一下您要在其中新增端點的設定檔。If you not, you can find it by clicking Browse, then CDN profiles, and clicking on the profile you plan to add your endpoint to.

    此時會顯示 [CDN 設定檔] 刀鋒視窗。The CDN profile blade appears.

    CDN 設定檔

  2. 按一下 [新增端點] 按鈕。Click the Add Endpoint button.

    [加入端點] 按鈕

    此時會顯示 [加入端點] 刀鋒視窗。The Add an endpoint blade appears.

    [加入端點] 刀鋒視窗

  3. 輸入這個 CDN 端點的 [名稱] 。Enter a Name for this CDN endpoint. 此名稱用於存取位於網域 <endpointname>.azureedge.net 的快取資源。This name is used to access your cached resources at the domain <endpointname>.azureedge.net.
  4. 在 [原始來源類型] 下拉式清單中,選取您的原始來源類型。In the Origin type dropdown, select your origin type. 針對 Azure 儲存體帳戶選取 [儲存體]、針對 Azure 雲端服務選取 [雲端服務]、針對 Azure Web 應用程式選取 [Web 應用程式],若為其他任何可公開存取的 Web 伺服器來源 (裝載於 Azure 或其他位置),則請選取 [自訂原始來源]。Select Storage for an Azure Storage account, Cloud service for an Azure Cloud Service, Web App for an Azure Web App, or Custom origin for any other publicly accessible web server origin (hosted in Azure or elsewhere).

    CDN 原始來源類型

  5. 在 [原始主機名稱] 下拉式清單中,選取您的原始網域類型。In the Origin hostname dropdown, select or type your origin domain. 下拉式清單會列出您在步驟 4 中指定之類型的所有可用原始來源。The dropdown lists all available origins of the type you specified in step 4. 如果您選取 [自訂原始來源] 作為您的 [原始來源類型],請輸入自訂原始來源的網域。If you select Custom origin as your Origin type, enter the domain of your custom origin.
  6. 在 [原始路徑] 文字方塊中,輸入您要快取的資源路徑,或保留空白以允許快取位於您在步驟 5 中指定之網域中的任何資源。In the Origin path text box, enter the path to the resources you want to cache, or leave blank to allow cache any resource at the domain you specified in step 5.
  7. 在 [原始主機標頭] 中,輸入您要 CDN 連同每個要求一起傳送的主機標頭,或保留預設值。In the Origin host header, enter the host header you want the CDN to send with each request, or leave the default.

    警告

    某些類型的原始來源 (例如 Azure 儲存體和 Web Apps) 要求主機標頭必須符合原始來源的網域。Some types of origins, such as Azure Storage and Web Apps, require the host header to match the domain of the origin. 除非您的原始來源需要與其網域不同的主機標頭,否則您應該保留預設值。Unless you have an origin that requires a host header different from its domain, you should leave the default value.

  8. 在 [通訊協定] 和 [原始連接埠] 中,指定用來存取原始來源之資源的通訊協定和連接埠。For Protocol and Origin port, specify the protocols and ports used to access your resources at the origin. 至少必須選取一個通訊協定 (HTTP 或 HTTPS)。At least one protocol (HTTP or HTTPS) must be selected. 使用 CDN 提供的網域 (<endpointname>.azureedge.net) 來存取 HTTPS 內容。Use the CDN-provided domain (<endpointname>.azureedge.net) to access HTTPS content.

    注意

    [原始連接埠] 只會影響端點用來從原始來源擷取資訊的連接埠。The Origin port only affects what port the endpoint uses to retrieve information from the origin. 不論 [原始連接埠] 為何,端點本身只會透過預設 HTTP 和 HTTPS 連接埠 (80 和 443) 提供給終端用戶端使用。The endpoint itself is only available to end clients on the default HTTP and HTTPS ports (80 and 443), regardless of the Origin port.

    來自 Akamai 的 Azure CDN 端點不允許原始來源的完整 TCP 連接埠範圍。Azure CDN from Akamai endpoints do not allow the full TCP port range for origins. 如需不允許的原始連接埠清單,請參閱 來自 Akamai 的 Azure CDN 允許的原始連接埠For a list of origin ports that are not allowed, see Azure CDN from Akamai Allowed Origin Ports.

    使用 HTTPS 存取 CDN 內容具有下列限制:Accessing CDN content using HTTPS has the following constraints:

    • 您必須使用 CDN 所提供的 SSL 憑證。You must use the SSL certificate provided by the CDN. 不支援第三方憑證。Third-party certificates are not supported.
    • Azure CDN 自訂網域的 HTTPS 支援僅適用於 Verizon 提供的 Azure CDN 產品 (標準版和進階版)。HTTPS support for Azure CDN custom domains is available only with Azure CDN from Verizon products (Standard and Premium). 此功能不支援透過 Akamai 提供的 Azure CDN 產品。It is not supported on Azure CDN from Akamai products. 如需詳細資訊,請參閱在 Azure CDN 自訂網域上設定 HTTPSFor more information, see Configure HTTPS on an Azure CDN custom domain.
  9. 按一下 [ 新增 ] 按鈕,以建立新的端點。Click the Add button to create the new endpoint.

    端點建立之後,即會出現在設定檔的端點清單中。After the endpoint is created, it appears in the list of endpoints for the profile.

    CDN 端點

    重要

    因為需要一段時間才能傳播註冊,所以端點不會立即可供使用。Because it takes time for the registration to propagate, the endpoint will not be immediately available for use. 若為 來自 Akamai 的 Azure CDN 設定檔,通常會在一分鐘之內完成傳播。For Azure CDN from Akamai profiles, propagation usually completes within one minute. 若為來自 Verizon 的 Azure CDN 設定檔,則通常會在 90 分鐘之內完成傳播,但在某些情況下可能會更久。For Azure CDN from Verizon profiles, propagation usually completes within 90 minutes, but in some cases can take longer.

    嘗試在端點組態傳播到 POP 之前,就使用 CDN 網域名稱的使用者可收到 HTTP 404 回應碼。Users who try to use the CDN domain name before the endpoint configuration has propagated to the POPs can receive HTTP 404 response codes. 如果在端點建立好後已過了好幾個小時,而您仍然收到 404 回應,請參閱針對傳回 404 狀態的 CDN 端點進行疑難排解If it's been several hours since you created your endpoint and you're still receiving 404 responses, see Troubleshooting CDN endpoints returning 404 statuses.

另請參閱See Also