All Products
Search
Document Center

CDN:Accelerate content delivery for infographic and video websites

Last Updated:Sep 14, 2024

If your website provides images, text, and on-demand videos, you can use Alibaba Cloud CDN to accelerate content delivery. This topic describes how to accelerate content delivery for infographic and video websites.

Prerequisites

Scenarios

Alice wants to accelerate content delivery for a small-sized community website. Information about the website includes:

  • Domain name: aliyundoc.com.

  • Website content: images, text, and on-demand videos.

  • Acceleration region: Chinese mainland. Visitors to the website are mostly located in the Chinese mainland.

  • Other services: Image and video files are stored in an Object Storage Service (OSS) bucket. HTTPS secure acceleration is used to encrypt data transmission.

Procedure

The following procedure shows how to use Alibaba Cloud CDN to accelerate content delivery for a website. The preceding scenario is used as an example.配置流程

Step 1: Add a domain name

The images and videos provided by the website are of different workload types. Therefore, you must use different domain names to accelerate the delivery of images and videos.

  • Domain name for image-based services: image.developer.aliyundoc.com

  • Domain name for video-based services: video.developer.aliyundoc.com

  1. Log on to the Alibaba Cloud CDN console.

  2. In the left-side navigation pane, click Domain Names.

  3. On the Domain Names page, click Add Domain Name.

  4. Add a domain name.

    On the Add Domain Name page, configure the parameters that are described in the following table. In this example, image.developer.aliyundoc.com is used.

    Note

    The first time a domain name is added to Alibaba Cloud CDN, Alibaba Cloud CDN verifies the ownership only of the root domain name. For more information, see Verify the ownership of a domain name. If the root domain name has already passed ownership verification, skip this operation.

    Service type

    Domain Name to Accelerate

    Business Type

    Region

    Image-based services

    image.developer.aliyundoc.com

    Image and Small File

    Chinese Mainland Only

    Video-based services

    video.developer.aliyundoc.com

    VOD

    Chinese Mainland Only

  5. Configure an origin server.

    In this example, an OSS bucket is used as the origin server. Requests for resources that are not cached or have expired on points of presence (POPs) are redirected to the OSS bucket. Then, the retrieved resources are cached on POPs.

    1. In the Add Origin Server dialog box, configure the parameters that are described in the following table.

      Parameter

      Description

      Origin Info

      Select OSS Domain and then select the OSS bucket in which the resources are stored from the Domain Name drop-down list. OSS buckets that belong to the current Alibaba Cloud account are displayed. You can also enter the public domain name of the OSS bucket, such as xxx.oss-cn-hangzhou.aliyuncs.com. Internal domain names of OSS buckets are not supported. You can view the public domain name of an OSS bucket in the OSS console.

      Priority

      If you specify only one origin server, you do not need to specify primary or secondary origin servers. You can keep the default settings.

      Weight

      Port

    2. Click OK.

  6. After you add an origin server, click Next.

  7. Wait for manual verification to complete.

    Note

    If the domain name does not need to be manually verified, proceed to the next step. In the next step, you can configure the parameters based on your business requirements.

    After the domain name passes the verification, the status of the domain name changes to Enabled. In this case, the domain name is added to Alibaba Cloud CDN.

    image

  8. Repeat the preceding steps to add video.developer.aliyundoc.com to Alibaba Cloud CDN.

Step 2: Configure the domain name

To improve acceleration performance, secure data transmission, and accelerate content delivery, you can enable the corresponding features based on your business requirements.

  1. Log on to the Alibaba Cloud CDN console.

  2. In the left-side navigation pane, click Domain Names.

  3. On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column.

  4. Configure the features based on your business requirements. The following table describes the features.

    Scenario

    Description

    Configuration

    Specify the site to which POPs redirect requests

    If you set the origin server type to OSS Domain, the Domain Type parameter in Origin Host is automatically set to Origin Domain. In this case, retain the default settings.

    If the OSS bucket is mapped to a custom domain name, such as origin.developer.aliyundoc.com, set the Domain Type parameter to Custom Domain, and set the origin host to origin.developer.aliyundoc.com. For more information, see Configure the default origin host. In other cases, you do not need to modify the origin host settings.

    Configure the default origin host

    Grant Alibaba Cloud CDN access permissions on private OSS buckets

    If you set the access control list (ACL) of the OSS bucket to private, you must grant Alibaba Cloud CDN access permissions on the private OSS bucket.

    Enable access to private OSS buckets

    Increase the cache hit ratio

    Specify a time to live (TTL) value for cached resources based on the following rules to increase the cache hit ratio:

    • Specify a TTL of one month or longer for static files that are infrequently updated, such as images and application packages.

    • Specify a TTL based on your business requirements for static files that are frequently updated, such as JavaScript and CSS files.

    • Specify a TTL of 0 seconds to disable caching for dynamic files, such as PHP, JSP, and ASP files.

    Create a cache rule for resources

    Improve data transmission security

    You need to obtain an SSL certificate before you can enable HTTPS. You can use Certificate Management Service to apply for and purchase SSL certificates.

    Note

    HTTPS secure acceleration is a value-added service. After you enable HTTPS, you are charged based on the number of HTTPS requests. You cannot use data transfer plans to offset the fees. For more information about the pricing of HTTPS secure acceleration, see Billing of value-added services.

    1. Purchase an SSL certificate. For more information, see Purchase an SSL certificate.

    2. Apply for an SSL certificate. For more information, see Submit a certificate application.

    3. Configure an SSL certificate: Set the Certificate Source parameter to SSL Certificates Service.

    Protect websites from hotlinking and IP theft

    URL signing must work with the origin server because the origin server is required to generate signed URLs based on the authentication algorithm that is specified for the signing type in Alibaba Cloud CDN.

    Configure URL signing

    • Increase the cache hit ratio

    • Increase file distribution efficiency

    After you enable the parameter filtering feature, POPs generate hash keys while removing the parameters that follow the question mark (?).

    Ignore parameters

    Accelerate resource retrieval

    After you enable the range origin fetch feature, the OSS bucket that functions as the origin server returns the file chunk that is specified by the Range header to POPs. This reduces origin traffic and accelerates content delivery.

    Note

    The range origin fetch feature is suitable for large file distribution scenarios such as audio and video streaming. Range origin fetch is not suitable for small file distribution scenarios. You do not need to enable the range origin fetch feature when you use Alibaba Cloud CDN to accelerate the delivery of images.

    Range origin fetch

    Improve website security

    We recommend that you enable security features based on your business requirements to reinforce protection for your website.

    Configure bandwidth caps

    You can specify a bandwidth cap to prevent unexpected high bills due to attacks.

  5. Copy the settings.

    Copy the settings of image.developer.aliyundoc.com to video.developer.aliyundoc.com.

    Note

    Skip this step when you configure the first domain name image.developer.aliyundoc.com. You need to copy the settings when you configure video.developer.aliyundoc.com.

    1. On the Domain Names page, find image.developer.aliyundoc.com and click Copy Configurations in the Actions column.

    2. Select the settings that you want to copy and click Next.

    3. Select video.developer.aliyundoc.com and click Next.

    4. In the Copy Configurations dialog box, click OK.

Step 3: (Optional) Test whether the domain name is accessible

After you add the domain name to Alibaba Cloud CDN, we recommend that you test whether the domain name is accessible before you update the CNAME record of the domain name. This ensures that DNS updates do not affect the services of the domain name. For more information, see (Optional) Test whether a domain name is accessible.

Step 4: Add a CNAME record

After you add a domain name to Alibaba Cloud CDN, the system assigns a CNAME to the domain name. You must add a CNAME record to the system of your DNS service provider to map the domain name to the CNAME before requests can be redirected to POPs. Otherwise, CDN acceleration cannot take effect.

Each domain name is assigned a unique CNAME. In the following example, Alibaba Cloud DNS is used to show how to add a CNAME record to the system. For more information, see Add a CNAME record for a domain name.

Domain name

Record Type

Hostname

DNS Request Source

Record Value

TTL

image.developer.aliyundoc.com

CNAME

image

Default

image.developer.aliyundoc.com.w.kunlunsl.com

Keep the default setting.

video.developer.aliyundoc.com

CNAME

video

Default

video.developer.aliyundoc.com.a.lahuashanbx.com

Keep the default setting.