Configure Domain Name System (DNS) records for a web server to enable access to your website using a domain name, such as example.com, instead of an IP address. This guide describes the procedure for a basic website DNS configuration.
Before you begin
A domain name has been purchased.
The target domain name must be in the domain name list of Alibaba Cloud DNS - Public Zone. If the domain name is not found:
Domains purchased from Alibaba Cloud are added automatically. If you have not purchased a domain name, you can purchase one from Alibaba Cloud Domain Names.
If you purchase a domain name from a third-party registrar, manually add it to Alibaba Cloud DNS - Public Zone and change the DNS server addresses. For more information, see Migrate DNS services to Alibaba Cloud DNS.
Get the public IP address of your server.
If you use an Elastic Compute Service (ECS) instance or a dedicated virtual machine, find the public IP address in the product console. For example, 47.100.XX.XX.
If you use a web hosting service, get the public IP address from your provider.
Ensure your website service is running.
The web application must be running on the server and accessible via its IP address. The server's firewall or security group must allow inbound traffic on port 80 (HTTP) and port 443 (HTTPS).
Procedure
Step 1. Add a record for the root domain (@)
This step points your root domain (for example,example.com) to your server's IP address.
Go to Alibaba Cloud DNS - Public Zone, find the target domain, and click DNS Settings.
Click Add Record. Add a DNS record with the Host set to
@. For more information about the form fields, see Add a DNS record.Parameter
Recommended Value
Description
Record type
APoints a domain name to an IPv4 address.
Host
@Represents the primary domain name.
Resolution line
Default
Takes effect for queries from all sources.
Record value
Your server's public IP addressEnter the IP address in the Before you begin section.
TTL
10 minutes (600 seconds)
The amount of time the record is cached in local DNS servers. A lower Time to Live (TTL) helps configuration changes take effect faster. The default value is recommended.
Click OK to save.

Step 2. Add a DNS record for the www subdomain
This step ensures that users can access your website using www.example.com. This is a common access pattern for users.
On the same DNS Settings page, click Add Record again and configure the following parameters:
Parameter
Recommended Value
Description
Record Type
CNAMEPoints the
wwwdomain name to another domain name.NoteWhy is CNAME recommended?
By pointing the
wwwrecord to the root domain using a CNAME, you only need to update the A record for the root domain (@) if your server's IP address changes. Thewwwrecord updates automatically, which simplifies maintenance.Host
wwwRepresents the
wwwsubdomain.Resolution Line
Default
Takes effect for requests from all sources.
Record Value
example.comEnter your primary domain name.
TTL
10 minutes (600 seconds)
Keep the default value.
Click OK.
Step 3. Verify the records
DNS records take some time to propagate globally, usually within the 10-minute TTL you set. You can verify the records in the following ways:
Browser access: In a browser, visit
http://your-domain.comandhttp://www.your-domain.comto check whether your website is accessible.Command-line interface: Open a terminal or command prompt on your computer and run the following commands. Check if the returned IP address matches the one you configured.
nslookup your-domain.com nslookup www.your-domain.com
Limits
DNS and ports
The core function of DNS is to translate a domain name into an IP address. It cannot detect or specify a port number.
When you access a domain name in a browser, the browser sends a request to port
80(HTTP) or port443(HTTPS) on the server by default.If your web service runs on a non-standard port, such as
8080, users must include the port number when visiting the service, for example,http://example.com:8080. Non-standard ports are generally not suitable for public websites.
Solution: To use a non-standard port, configure a reverse proxy, such as a self-managed Nginx reverse proxy, on the server or use Application Load Balancer (ALB) to forward traffic from port 80 or 443 to the actual port of the backend service, hiding the port details from users.
Billing
Public Zone includes a free tier. Adding basic DNS records such as
AandCNAMEis free.The Free Edition does not include a Service Level Agreement (SLA). For higher quality and more stable DNS services, purchase a paid tier. For more information, see Purchase an instance.
FAQ
Why is my domain name still inaccessible after adding DNS records?
How do I point all undefined subdomains, such as blog.example.com, to my website?
What do I do if a "DNS record conflict" error?
Related topics
For a detailed description of the fields for adding a DNS record, see Add a DNS record.
To confirm the resolution validity, see Methods for testing DNS record validity. If the resolution fails, see Quick troubleshooting for resolution not taking effect.
To understand potential conflicts, see Rules for DNS record conflicts.
To add a wildcard DNS record and set the host to *, see Wildcard domain names.
If you encounter issues during setup, see the following documents:
For issues related to adding a DNS record, see FAQ about adding DNS records.
If the DNS record has not taken effect and you cannot identify the cause, see FAQ about DNS resolution failures or website inaccessibility.