Add DNS records for a website

更新时间:
复制 MD 格式

Configure DNS records so users can access your website by domain name, such as example.com, instead of IP address. Complete basic DNS setup in five minutes.

Prerequisites

  1. Have a domain name.

    Your domain name must be listed in the domain list of Alibaba Cloud DNS - Public Zone. If the target domain name is not listed:

    1. If you purchased the domain name from Alibaba Cloud, it is automatically added. If you have not yet purchased a domain name, you can purchase one from Alibaba Cloud Domain Registration.

    2. If you purchased the domain name from a third-party registrar, you must add it to Public Zone and update the DNS server addresses. Migrate a domain to Alibaba Cloud DNS.

  2. The public IP address of your server is available.

    • If your service runs on an Elastic Compute Service (ECS) instance, find the public IP address in the ECS console. Example: 47.100.XX.XX.

    • If you use web hosting, contact your provider for the service endpoint.

  3. The website is running and accessible.

    Verify that you can access the web application by IP address. The server firewall or security group must allow inbound traffic on port 80 (HTTP) and port 443 (HTTPS).

Procedure

Step 1. Add a DNS record for the root domain (@)

  1. Go to the Alibaba Cloud DNS - Public Zone page, find the target domain name, and click Settings.

  2. Click Add Record. Add a DNS record and set the Hostname parameter to @. Add a DNS record.

    Parameter

    Recommended Value

    Description

    Record Type

    A

    Points a domain name to an IPv4 address.

    Hostname

    @

    Represents the root domain.

    Query Source

    Default

    Applies to requests from all sources.

    Record Value

    Your server's public IP address

    Enter the IP address that you obtained in the Prerequisites section.

    TTL/Record Values Load Strategy

    10 minutes (600 seconds)

    Keep the default value. Add a DNS record.

    image

Step 2. Verify the DNS record

DNS records take up to 10 minutes (the TTL you set) to propagate. Verify the record using either method:

  • Browser: Enter http://your-domain.com in a browser and confirm the website loads.

  • Command line: Run the following commands and verify the returned IP address matches your configuration.

    nslookup your-domain.com
    dig your-domain.com

Limitations

DNS and ports

DNS translates domain names to IP addresses and cannot specify a port number.

  • Browsers default to port 80 (HTTP) or port 443 (HTTPS).

  • If your service uses a non-standard port such as 8080, users must include it in the URL, for example, http://example.com:8080. This is not recommended for public websites.

Solution: Configure a reverse proxy such as a self-managed Nginx reverse proxy, or use Application Load Balancer (ALB) to forward traffic from port 80 or 443 to your backend port.

Billing

  • The Public Zone feature includes a free tier. Adding basic DNS records such as A and CNAME records is free.

  • The Free Edition does not include an SLA. For higher-quality DNS, purchase a paid instance. Purchase and bind domain names.

FAQ

Why is my domain name still inaccessible after I add the DNS record?

Troubleshoot the issue:

  1. Wait for DNS propagation: Changes take up to 10 minutes to propagate. Wait and try again.

  2. Browsers default to HTTPS. If your website lacks an HTTPS certificate, change HTTPS to HTTP in the address bar.

  3. Clear local cache: Clear the browser cache, or flush the DNS cache with ipconfig /flushdns (Windows) or sudo dscacheutil -flushcache (macOS).

  4. Check server configuration: Confirm the firewall or security group allows traffic on ports 80 and 443.

  5. Check web service: Log on to the server and confirm Nginx, Apache, or your web server is running.

  6. Check ICP filing: If your server is in the Chinese mainland, confirm the domain has a valid ICP filing.

How do I point all undefined subdomains, such as blog.example.com, to the root website?

Add a wildcard DNS record with the host set to *.

Parameter

Recommended Value

Description

Record Type

CNAME

Points the * domain name to another domain name.

Host

*

This has the lowest priority and serves as a fallback for all undefined subdomains.

Resolution Line

Default

Applies to requests from all sources.

Record Value

example.com

Enter your root domain name.

TTL

10 minutes (600 seconds)

Keep the default value.

What do I do if a "DNS record conflict" error occurs?

The record you are adding conflicts with an existing one. For example, a host such as @ cannot have both a CNAME and another record type (Rules for DNS record conflicts). Delete the conflicting record and add the new one.

Related videos

Related topics