After you add a domain name to Alibaba Cloud CDN, the system assigns a CNAME to the domain name. You need to add a CNAME record in the system of your DNS provider to map the domain name to the CNAME. After doing so, the acceleration takes effect.
Prerequisites
You have activated CDN. If not, see Activate Alibaba Cloud CDN.
You have added a domain name. If not, see Add a domain name.
Usage notes
If an A record has been configured for your domain name, check whether the CNAME can be mapped by referring to (Optional) Test domain name accessibility. If the CNAME can be mapped, change the A record to the corresponding CNAME record. Perform this operation during off-peak hours.
If a CNAME record has been configured for your domain name, but when you try to access the page, it keeps redirecting you, refer to What should I do if redirects occur after my domain name is accelerated by Alibaba Cloud CDN?
If a CNAME record has been configured for your domain name but a message indicating that an unsupported protocol is used appears during access, we recommend that you configure an SSL certificate.
Step 1: Obtain the CNAME of the accelerated domain name
Log on to the Alibaba Cloud CDN console, navigate to the Domain Names page, and then copy the CNAME of the domain name.
Step 2: Add a CNAME record
This procedure varies depending on your DNS provider. In this topic, Alibaba Cloud and Tencent Cloud are used as examples.
If you add a CNAME record for a wildcard domain such as *.aliyundoc.com, its second-level domains such as example.aliyundoc.com can be accelerated, while the third-level ones cannot. For more information, see Does Alibaba Cloud CDN support wildcard domain names?
Make sure that the DNS records do not conflict with each other in the same system.
The server that Alibaba Cloud CDN uses for domain name resolution is deployed in the Chinese mainland. If you configure region-specific DNS settings for your domain name, for example, you add a CNAME record for your Alibaba Cloud CDN-accelerated domain name only in regions outside the Chinese mainland, including Hong Kong (China), Macao (China), and Taiwan (China), the domain name cannot be mapped to the CNAME. The CNAME status is Pending Configuration in the Alibaba Cloud CDN console. However, acceleration for the domain name is not affected.
CNAMEs that are assigned by Alibaba Cloud CDN, DCDN, ApsaraVideo Live, and ApsaraVideo VOD can be used only for domain name resolution. If Alibaba Cloud detects that your CNAME is being used for unauthorized or malicious activities, it reserves the right to close your Alibaba Cloud account and remove the domain names.
Add a CNAME record on Alibaba Cloud
If your DNS provider is Alibaba Cloud, perform the following steps to add a CNAME record for the domain name:
Log on to the Alibaba Cloud DNS console with the Alibaba Cloud account to which the domain name belongs.
Optional. Add a domain name that is not registered with Alibaba Cloud.
NoteIf the domain name is not registered with Alibaba Cloud, you must add it to Alibaba Cloud DNS before you can add a DNS record for it. For more information, see Manage domain names. If the domain name is registered with Alibaba Cloud, skip this step.
On the Authoritative DNS Resolution page, find the domain name that you want to manage and click DNS Settings in the Actions column.
Click Add DNS Record to add a CNAME record.
NoteThe CNAME record of a specific domain name takes precedence over that of a wildcard domain name. If you want to accelerate a wildcard domain, where the DNS record contains an asterisk (*), you must delete all other DNS records of second-level domains that match the wildcard domain.
Parameter
Example
Description
Record Type
CNAME
Select CNAME.
Hostname
Subdomains:
If the domain name to be accelerated is
example.aliyundoc.com
, enterexample
.If the domain name to be accelerated is
www.example.aliyundoc.com
, enterwww.example
.
Wildcard domains:
If the domain name to be accelerated is
.aliyundoc.com
, enter*
.If the domain name to be accelerated is
*.example.aliyundoc.com
, enter*.example
.
Root domains: If the root domain is
aliyundoc.com
and domain name to be accelerated isaliyundoc.com
, enter@
.
NoteDomain name resolution settings apply to the domain name that you register, such as aliyundoc.com, or the left part of the domain name. When you specify the Hostname parameter, enter the part to be resolved. For example, if the domain name to be accelerated is example.aliyundoc.com, enter example.
For subdomains, enter the prefix of the subdomain.
For wildcard domains, enter
*
.For root domains, enter
@
.
NoteFor more information about subdomains, see Terms.
DNS Request Source
Default
We recommend that you keep the default setting.
Record Value
www.example.com.w.kunlunsl.com
Enter the CNAME of the domain name.
NoteFor example, example.aliyundoc.com and www.example.aliyundoc.com correspond to different CNAMEs. If you want to accelerate a subdomain, add it to Alibaba Cloud CDN. Alibaba Cloud then assigns a CNAME to it. Alternatively, you can add a wildcard domain to Alibaba Cloud CDN. Subdomains that match the wildcard domain are mapped to the CNAME of the wildcard domain. For more information, see Add a domain name.
TTL Period
10 (Recommended)
Enter the time-to-live (TTL) for the CNAME record. A shorter TTL means that changes take effect more quickly. The default TTL is 10 minutes. We recommend that you keep the default setting.
Click OK.
Add a CNAME record on Tencent Cloud
If your DNS provider is Tencent Cloud, perform the following steps to add a CNAME record for the domain:
Log on to the DNSPod console.
On the DNSPod page, click Add Records to add a CNAME record.
Parameter
Example
Description
Host
Subdomains:
If the domain name to be accelerated is
example.aliyundoc.com
, enterexample
.If the domain name to be accelerated is
www.example.aliyundoc.com
, enterwww.example
.
Wildcard domains:
If the domain name to be accelerated is
.aliyundoc.com
, enter*
.If the domain name to be accelerated is
*.example.aliyundoc.com
, enter*.example
.
Root domains: If the root domain is
aliyundoc.com
and domain name to be accelerated isaliyundoc.com
, enter@
.
NoteDomain name resolution settings apply to the domain name that you register, such as aliyundoc.com, or the left part of the domain name. When you specify the Hostname parameter, enter the part to be resolved. For example, if the domain name to be accelerated is example.aliyundoc.com, enter example.
For subdomains, enter the prefix of the subdomain.
For wildcard domains, enter
*
.For root domains, enter
@
.
NoteFor more information about subdomains, see Terms.
Type
CNAME
Select CNAME.
Split Zone
Default
We recommend that you keep the default setting.
Value
www.example.com.w.kunlunsl.com
Enter the CNAME of the domain name.
NoteFor example, example.aliyundoc.com and www.example.aliyundoc.com correspond to different CNAMEs. If you want to accelerate a subdomain, add it to Alibaba Cloud CDN. Alibaba Cloud then assigns a CNAME to it. Alternatively, you can add a wildcard domain to Alibaba Cloud CDN. Subdomains that match the wildcard domain are mapped to the CNAME of the wildcard domain. For more information, see Add a domain name.
Weight
N/A
You do not need to set this parameter.
MX
N/A
You do not need to set this parameter.
TTL
We recommend that you keep the default setting.
Enter the TTL for the CNAME record. A shorter TTL means that changes take effect more quickly.
Click Confirm.
Step 3: Verify that the CNAME record takes effect
Method 1: Use the Alibaba Cloud CDN console
Log on to the Alibaba Cloud CDN console and navigate to the Domain Names page.
Find the domain name and move the pointer over the CNAME Status column. If the CNAME status is Configured, the CNAME has taken effect.
NoteIf you add a CNAME record, it takes effect immediately. If you modify a CNAME record, it takes 10 minutes for the update to take effect because the default TTL of a CNAME record is 10 minutes. During this period, the status may be displayed as Pending Configuration in the Alibaba Cloud CDN console until the update takes effect. The actual time period varies based on the TTL that you specify for the CNAME record.
Method 2: Run the nslookup command
Start Command Prompt in Windows or Terminal in macOS or Linux.
Run the nslookup -type=CNAME domainName command. If the CNAME in the output is the same as the CNAME assigned to the domain name, Alibaba Cloud CDN takes effect for the domain name. Example:
nslookup -type=CNAME www.example.com
References
CNAME record
A Canonical Name (CNAME) record is a type of DNS record that points one domain name to another. For more information, see What is DNS resolution?
How Alibaba Cloud CDN works
After you add a domain name, Alibaba Cloud CDN assigns a CNAME to it. The CNAME is resolved by the DNS service provider and points to points of presence (POPs). To accelerate content delivery, you need to map the original DNS record of the accelerated domain name, such as example.aliyundoc.com, to the assigned CNAME, such as example.aliyundoc.com.w.kunlunle.com. This way, client requests can be redirected to POPs to accelerate access. For more information, see How it works.
Domain name resolution
Domain name resolution is the process of converting a domain name, such as example.aliyundoc.com, into an IP address of the client. For more information, see What is DNS resolution?