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

  • Alibaba Cloud CDN is activated. For more information about how to activate Alibaba Cloud CDN, see Activate Alibaba Cloud CDN.
  • An origin server with stable performance is deployed.
  • A domain name to be accelerated is prepared, and the domain name has a valid Internet Content Provider (ISP) number. In the following examples, the domain names to be accelerated are image.example.com and video.example.com. If the domain name does not have an ICP number, you can apply for one through Alibaba Cloud ICP Filing System.

Scenarios

Alice wants to accelerate content delivery for a small-sized community website. The information about the website is:
  • Website domain name: example.com.
  • Website content: images, text, and on-demand videos.
  • Accelerated region: mainland China. Visitors to the website are mostly located in mainland China.
  • 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. Procedure

Step 1: Add the domain name to Alibaba Cloud CDN

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 images: image.example.com
  • Domain name for videos: video.example.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 the domain name to Alibaba Cloud CDN.

    On the Add Domain Name page, set the parameters, as described in the following table. image.example.com is used in this example.

    Workload type Domain Name to Accelerate Business Type Region
    Image image.example.com Image and Small File Mainland China Only
    Video video.example.com VOD Mainland China 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 edge nodes are redirected to the OSS bucket. Then, the retrieved resources are cached on edge nodes.

    1. In the Add Origin Server dialog box, set the following parameters.
      Origin server settings
      Parameter Description
      Origin Info Select OSS Domain and then select the OSS bucket where the resources are stored from the Domain Name drop-down list. OSS buckets that belong to the current Alibaba Cloud account are displayed. Alternatively, you can enter the public endpoint of the OSS bucket, for example, xxx.oss-cn-hangzhou.aliyuncs.com. Internal endpoints of OSS buckets are not supported. You can check the public endpoint of an OSS bucket in the OSS console.
      Priority If only one origin server is specified, you do not need to specify primary or second origin servers. You can keep the default setting.
      Weight
      Port
    2. In the message that appears, click OK.
  6. Click Next.
    If this is the first time the domain name is added to Alibaba Cloud CDN, Alibaba Cloud CDN must verify the ownership of the domain name. If the domain name has already passed the verification, skip this step. For more information, see Verify the ownership of a domain name.
  7. Wait for manual verification.

    It takes one to two business days to verify the ownership of a domain name. If the origin server is an ECS instance or an OSS bucket, you can submit a ticket. It takes less time to verify the ownership of an ECS instance or an OSS bucket.

    After the domain name passes the verification, you can check the status of the domain name on the Domain Names page. If the domain name is in the Enabled state, it indicates that the domain name is added to Alibaba Cloud CDN.

  8. Repeat this step to add video.example.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 relevant 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 of the domain name.
  4. Enable the following features as needed.
    Scenario Description Configuration
    Specify a site to which edge nodes redirect requests If you set the origin server type to OSS Domain, Origin Host is automatically set to Origin Domain. In this case, you do not need to modify the origin host settings. Keep the default settings.

    If the origin server is an OSS bucket that is associated with a custom domain name, such as origin.example.com, you must configure an origin host. Set Domain Type to Custom Domain, and set the origin host to origin.example.com. For more information, see Configure an origin host. In other cases, you do not need to modify the origin host settings.

    Configure an origin host
    Retrieve resources from a private OSS bucket If the OSS bucket is set to private, you must grant Alibaba Cloud CDN access permissions on the private OSS bucket. Enable access to a private OSS bucket
    Increase the cache hit ratio
    Set a proper time-to-live (TTL) value for cached resources based on the following rules to increase the cache hit ratio:
    • Specify a TTL value of one month or longer for static files that are infrequently updated, such as images and application packages.
    • Specify a TTL value based on your business requirements for static files that are frequently updated, such as JavaScript and CSS files.
    • Specify a TTL value of 0 seconds to disable caching for dynamic files, such as PHP, JSP, and ASP files.
    Set a TTL value for cached resources
    Improve data transmission security You must acquire an SSL certificate before you can enable HTTPS. You can use SSL Certificates Service to apply for and purchase SSL certificates.
    Note HTTPS is a value-added service. After you enable HTTPS, you are charged based on the number of HTTPS requests. You cannot use CDN data transfer plans to offset the fees. For more information about the pricing of HTTPS, see HTTPS requests for static content.
    1. For more information about how to purchase SSL certificates, see Purchase an SSL Certificates Service instance.
    2. For more information about how to apply for SSL certificates, see Apply for a certificate.
    3. Configure an SSL certificate: Set Certificate Source to SSL Certificates Service.
    Protect a website from hotlinking and click farming URL signing must work with the origin server because the origin server is required to generate signed URLs based on the authentication algorithm set for the signing type specified in Alibaba Cloud CDN. Configure URL signing
    • Increase the cache hit ratio
    • Increase file distribution efficiency
    After parameter filtering is enabled, edge nodes generate hash keys while removing the parameters that follow the question mark (?) in URLs. Enable Alibaba Cloud CDN to retain only specified URL parameters and ignore other URL parameters
    Accelerate resource retrieval After object chunking is enabled, the OSS bucket that functions as the origin server returns the chunk of file that is specified by the Range header to edge nodes. This reduces data transfer on the origin server and accelerates content delivery.
    Note Object chunking is suitable for large file distribution scenarios such as audio and video streaming. It is not suitable for small file distribution. You do not need to enable object chunking when you use Alibaba Cloud CDN to accelerate the delivery of images.
    Object chunking
    Improve website security We recommend that you enable security features based on your business requirements to reinforce protection for your website.
  5. Copy the settings.
    Copy the settings of image.example.com to video.example.com.
    Note Skip this step when you configure the first domain name image.example.com. You can copy settings when you configure video.example.com.
    1. On the Domain Names page, find image.example.com and click Copy Configurations in the Actions column.
    2. Select the settings that you want to copy and click Next.
    3. Select video.example.com and click Next.
    4. In the Copy Configurations message, click OK.

Step 3: 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 Test whether a domain name is accessible (optional).

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 in the system of your DNS service provider to map the domain name to the CNAME before requests can be redirected to edge nodes. Otherwise, CDN acceleration cannot take effect.

Each domain name is assigned a unique CNAME. In the following example, Alibaba Cloud DNS is used to demonstrate how to add a CNAME record. For more information, see Add a CNAME record for a domain name.
Domain name Type Host ISP Line Value TTL
image.example.com CNAME image Default image.example.com.w.kunlunsl.com Keep the default setting.
video.example.com CNAME video Default video.example.com.a.lahuashanbx.com Keep the default setting.