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, see Activate Alibaba Cloud CDN.
  • An origin server with stable performance is deployed.
    Note If the accelerated region is Mainland China Only or Global, you must apply for an Internet Content Provider (ICP) number for the domain name. If the domain name does not have an ICP number, you can apply for an ICP number in 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: developer.aliyundoc.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.developer.aliyundoc.com
  • Domain name for videos: 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 the domain name to Alibaba Cloud CDN.

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

    Note The first time a domain name is added to Alibaba Cloud CDN, Alibaba Cloud CDN must verify the ownership of the domain name. 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, ignore this message.
    intl
    Workload type Domain Name to Accelerate Business Type Region
    Image image.developer.aliyundoc.com Image and Small File Mainland China Only
    Video video.developer.aliyundoc.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.
  7. Wait for manual review.
    Note If the domain name does not need to be manually verified, proceed to the next step. In the next step, you can set the parameters based on your business requirements.

    It takes one to two business days to complete the verification. If you require prioritized verification, submit ticket.

    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.

  8. Repeat this step 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 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.
  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.developer.aliyundoc.com, you must configure an origin host. Set Domain Type to Custom Domain, and set the origin host to origin.developer.aliyundoc.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 private OSS buckets
    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 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.
    • We recommend that you specify a TTL of 0 seconds to disable caching for dynamic files, such as PHP, JSP, and ASP files.
    Add a cache rule
    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 Billing of value-added services.
    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. Configure parameter filtering
    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.developer.aliyundoc.com to video.developer.aliyundoc.com.
    Note Skip this step when you configure the first domain name image.developer.aliyundoc.com. You can copy 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 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.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.