開始使用 Azure CDNGetting started with Azure CDN

本文說明如何藉由建立新的 CDN 設定檔和端點來啟用 Azure 內容傳遞網路 (CDN)This article describes how to enable Azure Content Delivery Network (CDN) by creating a new CDN profile and endpoint.

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

CDN 設定檔為 CDN 端點的集合。A CDN profile is a collection of CDN endpoints. 每個設定檔皆可包含一或多個 CDN 端點。Each profile can contain one or more CDN endpoints. 若要依網際網路網域、Web 應用程式或其他準則來組織您的 CDN 端點,您可以使用多個設定檔。To organize your CDN endpoints by internet domain, web application, or some other criteria, you can use multiple profiles.

注意

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 設定檔。Therefore, to use a mix of Azure CDN pricing tiers, you must create multiple CDN profiles.

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

  1. Azure 入口網站的左上方,選取 [建立資源]。In the Azure portal, in the upper left, select Create a resource.

  2. 在 [新增] 刀鋒視窗中,依序選取 [Web + 行動] 和 [CDN]。In the New blade, select Web + Mobile, then CDN.

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

    新增 CDN 設定檔

  3. 針對 [名稱],輸入 CDN 設定檔的唯一名稱。For Name, enter a unique name for your CDN profile.

  4. 針對 [訂用帳戶],選取要用於此 CDN 設定檔的訂用帳戶。For Subscription, select the subscription to use for this CDN profile.

  5. 針對 [資源群組],選取或建立資源群組。For Resource group, select or create a resource group. 如需資源群組的資訊,請參閱 Azure Resource Manager 概觀For information about resource groups, see Azure Resource Manager overview.

  6. 針對 [資源群組位置],選取用來存放 CDN 設定檔資訊的 Azure 位置。For Resource group location, select the Azure location to store your CDN profile information. 此位置不會影響 CDN 端點位置。This location has no impact on CDN endpoint locations.

  7. 對於 [定價層],選取定價層。For Pricing tier, select a tier. 如需每個定價層可用功能的比較,請參閱 Azure CDN 功能For a comparison of the features available with each pricing tier, see Azure CDN features.

    CDN 定價層選取項目

  8. (選擇性) 選取 [立即建立新的 CDN 端點],以顯示在建立設定檔的同時用於建立端點的選項。Optionally, select Create a new CDN endpoint now to display the options for creating an endpoint at the same time that you create the profile. 如需詳細資訊,請參閱建立新的 CDN 端點For more information, see Create a new CDN endpoint.

  9. 如果您想要在設定檔建立後將它儲存到儀表板,以便輕鬆尋找,請選取 [釘選至儀表板]。If you want to save the profile to your dashboard after it is created to make it easier to find, select Pin to dashboard.

  10. 選取 [建立] 以建立設定檔。Select Create to create the 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 not, you can find it by selecting All services, then selecting CDN profiles. 在 [CDN 設定檔] 窗格中,選取您打算新增至端點的設定檔。In the CDN profiles pane, select the profile to which you plan to add your endpoint.

    此時會顯示 [CDN 設定檔] 窗格。The CDN profile pane appears.

    CDN 設定檔

  2. 選取 [端點]。Select Endpoint.

    [加入端點] 按鈕

    此時會顯示 [新增端點] 窗格。The Add an endpoint pane appears.

    新增端點窗格

  3. 針對 [名稱],輸入新 CDN 端點的唯一名稱。For Name, enter a unique name for the new CDN endpoint. 此名稱用於存取位於網域 <endpointname>.azureedge.net 的快取資源。This name is used to access your cached resources at the domain <endpointname>.azureedge.net.

  4. 針對 [原始類型],選取一種原始類型。For Origin type, select an 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. 針對 [原始主機名稱],選取或輸入您的原始網域。For Origin hostname, select or enter your origin domain. 下拉式清單會列出您在步驟 4 中指定之類型的所有可用原始來源。The drop-down lists all available origins of the type you specified in step 4. 如果您選取 [自訂原始來源] 作為您的原始類型,請輸入自訂原始來源的網域。If you selected Custom origin as your origin type, enter the domain of your custom origin.

  6. 針對 [原始路徑],輸入您要快取的資源路徑,或保留空白以允許快取您在步驟 5 中指定之網域中的任何資源。For Origin path, enter the path to the resources you want to cache, or leave it blank to allow caching of any resource at the domain you specified in step 5.

  7. 針對 [原始主機標頭],輸入您要 Azure CDN 連同每個要求一起傳送的主機標頭,或保留預設值。For Origin host header, enter the host header you want Azure 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 value determines only the port the endpoint uses to retrieve information from the origin. 不論 [原始連接埠] 的值為何,端點本身只會透過預設 HTTP 和 HTTPS 連接埠 (80 和 443) 提供給終端用戶端使用。The endpoint itself is available only to end clients on the default HTTP and HTTPS ports (80 and 443), regardless of the Origin port value.

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

    當您使用 HTTPS 存取 CDN 內容時,有下列限制:When you access CDN content by using HTTPS, there are the following constraints:

    • 使用 CDN 所提供的 SSL 憑證。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. 選取 [新增] 來建立新的端點。Select Add 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 isn't 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 回應狀態。If you attempt to use the CDN domain name before the endpoint configuration has propagated to the POPs, you might receive an HTTP 404 response status. 如果在端點建立好後已過了好幾個小時,而您仍然收到 404 回應狀態,請參閱針對傳回 404 狀態的 CDN 端點進行疑難排解If it's been several hours since you created your endpoint and you're still receiving a 404 response status, see Troubleshooting CDN endpoints returning 404 statuses.

另請參閱See Also