Point Your Domain to Your Server (A Record)

Add one A record in your DNS panel to map your domain to your server's public IP, then verify it with dig and ping.

You've registered a domain and spun up a server. One crucial step remains: telling the world "when someone visits this domain, connect them to my server." That's what an A record does—it maps a domain name to an IPv4 address. Simple job, big payoff.

Before you start

Grab two things first.

  • Your server's public IP. On the server, run:
curl -4 ifconfig.me

You'll get something like 203.0.113.10—that's the value you'll enter. Make sure it's the public IP, not a private address such as 10.x, 172.x, or 192.168.x that shows up under ip a.

  • Access to your DNS panel. Log in to your domain or DNS provider's console and find the "DNS management" (sometimes "DNS records" or "Zone editor") page. The wording differs from panel to panel, but the fields are the same everywhere.

Add the A record

Create a new record. You'll typically see these fields:

  • Type: choose A.
  • Host / Name: enter @ for the root domain (example.com itself), or www for the www.example.com subdomain.
  • Value / Points to: paste the server's public IP from the step above, e.g. 203.0.113.10.
  • TTL: time to live, in seconds. Set it low for a first setup (say 600) so mistakes are quick to fix; bump it up to 3600 once things are stable.

Add both the root and www. Some visitors type example.com, others reach for www. Create two A records—one with host @, one with host www—both pointing to the same IP, so either form works.

Type   Host    Value           TTL
A      @       203.0.113.10     600
A      www     203.0.113.10     600

Save, and give the panel a moment to sync (anywhere from seconds to a few minutes).

Wait for propagation and verify

DNS is cached, so a new record isn't visible everywhere the instant you save it—usually a few minutes, occasionally longer depending on TTL. Check it from the command line.

Use dig to look up the record (on Ubuntu/Debian, install dnsutils if dig is missing):

sudo apt update && sudo apt install -y dnsutils
dig +short example.com A
dig +short www.example.com A

Each should print one line: your server's IP. To skip your local resolver's cache and ask a public DNS server directly, name one explicitly:

dig +short example.com A @8.8.8.8

You can also ping the domain to confirm it resolves to that IP (whether the ping succeeds depends on ICMP being allowed, but the IP shown is always the resolved one):

ping -c 4 example.com

If dig returns nothing or still shows an old IP, the record probably hasn't propagated yet or the host/value was mistyped. Wait a bit and re-check, or review the record in your panel.

What's next

Once the record resolves, your domain reaches the server—but the server still needs a program listening on ports 80/443 to answer. The next step is configuring a web server: set up an Nginx site that binds example.com and www.example.com to your web root, then add an HTTPS certificate on top.

Summary

  • An A record maps a domain to an IPv4 address; the value is your server's public IP.
  • Host @ is the root domain and www is the subdomain—add both, pointing to the same IP.
  • Start with a low TTL (like 600) so errors are easy to fix.
  • Verify with dig +short and ping; seeing your IP means success.
  • After it resolves, configure an Nginx site so the server actually answers requests.