Pointing a Domain to Your VPS: A DNS Primer
After buying a domain and a server, the first step is pointing the domain at the server. This is DNS resolution, and this article explains it with the minimum necessary concepts.
You only need two record types
- A record: points a domain at an IPv4 address. For example, set the A record of example.com to your VPS IP;
- CNAME record: points one domain at another domain. Commonly used for the www prefix: point the CNAME of www.example.com at example.com.
How to do it
Log in to your domain registrar (or DNS provider such as Cloudflare), open the DNS management page, and add two records:
- Host
@(the root domain), type A, value = your VPS IP; - Host
www, type CNAME, value = the root domain (or another A record to the same IP).
Leave TTL at the default. Propagation is not instant — it usually takes minutes to a few hours worldwide.
Verifying the record
Run ping example.com or nslookup example.com in a local terminal. If the returned IP is your VPS IP, the record works. If you see an old IP, your local DNS cache has not expired — wait or switch networks and try again.
Common questions
- Should I host DNS on Cloudflare? It is free, propagates fast, and adds optional CDN and protection — recommended. See the Cloudflare article in this help center;
- DNS resolves but the site won't open? Confirm the web service is running on the server and the firewall allows ports 80/443, then follow the article on troubleshooting a website that won't load;
- Can multiple domains point at one VPS? Yes — the web server distinguishes sites by hostname, so one VPS can host many websites.
本記事は SharkCloud 編集チームが AI を活用して作成し、人による確認を経て公開しています。