# Setting up a domain and pointing it anywhere

> How to buy a domain, configure DNS records, and connect it to GitHub Pages, a VPS, or a home server.

*Source: https://velstech.net/setup-domain · Updated: 2026-08-24 · Category: Networking · Tags: DNS, Self-hosting*

*Markdown version of [Setting up a domain and pointing it anywhere](https://velstech.net/setup-domain). [Read the full guide with interactive tools](https://velstech.net/setup-domain).*
*Also as Markdown: [Hindi](https://velstech.net/setup-domain.hi.md) · [Tamil](https://velstech.net/setup-domain.ta.md).*

---

A domain is the most powerful piece of internet real estate you can own. It's a
permanent address you control – and pointing it at a website, a server, or a home
machine only takes a few DNS records. This site runs exactly this way.

## Buying the domain

You buy a domain from a **registrar** – a company authorized to sell
names in a top-level domain (TLD). Pick wisely:

- Cloudflare Registrar – sells at cost price, no markup, free
management. Great value.

- Namecheap, Porkbun – cheap and beginner-friendly.

- GoDaddy – works, but expect upsells at checkout.

TLD choice matters more than people think:

- .com – the classic, most trusted, but often taken.

- .net, .org, .dev, .io – solid alternatives.

- Fancy TLDs (.xyz, .club) – cheap, but look less serious.

Watch out for **renewal price**: many domains are cheap the first year
and jump afterward. Cloudflare avoids this by pricing renewals the same.

## Understanding DNS records

A domain alone does nothing. You tell the world where it points using
**DNS records**. The ones you'll actually use:

```
Type     Example                         Purpose
──────────────────────────────────────────────────────────
A        185.199.108.153                 IPv4 address
AAAA     2606:4700:4700::1111            IPv6 address
CNAME    velsrocky.github.io             alias to another name
MX       mail.yourdomain.com             email delivery
TXT      "v=spf1 ..."                    verification / security
```

A record names map a domain to an IP. CNAME maps a domain to another domain – handy
for services that give you a name (like `username.github.io`).

## Scenario A: GitHub Pages (this site)

To connect a domain to a free GitHub Pages site:

```
A        @      ->  185.199.108.153
A        @      ->  185.199.109.153
A        @      ->  185.199.110.153
A        @      ->  185.199.111.153
CNAME    www    ->  username.github.io
```

- Add those records at your DNS provider.

- In the GitHub repo: Settings → Pages → Custom domain → enter your domain.

- GitHub verifies the records and issues a free HTTPS certificate automatically.

## Scenario B: a VPS or dedicated server

If you rent a server (Linode, DigitalOcean, Hetzner, a VPS), point your domain at its
IP:

```
A        @   ->  203.0.113.10      (your server's IP)
CNAME    www ->  @                    (www follows the root)
```

Then configure your web server (Nginx, Apache, Caddy) to serve your site and set up
HTTPS with a free **Let's Encrypt** certificate.

## Scenario C: a home server

Home networking adds a layer – your house has one public IP, shared by every device
via NAT. You need:

- Port forwarding – tell your router to send web traffic (port 443)
to your server's private IP.

- A fixed public IP – home connections often change IPs. Use a
DDNS service that updates a DNS record when your IP changes.

- HTTPS – Let's Encrypt can verify ownership via DNS records, so it
works on home IPs too.

> Security note: exposing a home server to the internet is real. Keep everything
> updated, use SSH keys, and consider Cloudflare's free proxy as an extra shield that
> hides your real IP.

## Email and verification records

Want `you@yourdomain.com`? That needs **MX records** pointing
at your mail provider (Gmail/Workspace, Zoho, or a custom mail server). Providers
also ask for **TXT records** (SPF, DKIM) to prove your domain owns its
mail.

## Common gotchas

- Propagation takes time – DNS changes can take minutes to 48 hours (usually a few minutes with a good provider). Be patient.

- Don't mix A and CNAME on the same name – either point the root via A records, or use CNAME for subdomains.

- HTTPS before DNS – some hosts won't issue a certificate until DNS resolves. Order: DNS first, then HTTPS.

- Keep records proxied: off (gray cloud) with GitHub Pages and home servers – Cloudflare's proxy can break direct connections.

🌐 Try the VelsTech CIDR / Subnet Calculator

Working out address ranges for a VPS or home network? Get the network, usable hosts, and broadcast for any IP/prefix in seconds.

[Open calculator →](https://velstech.net/cidr-calculator)

## That's it

Own the name, add a few records, and your domain points anywhere you own. Whether
it's free static hosting, a rented server, or a box in your closet – the DNS records
are the glue, and you now know exactly how they work.

---

*VelsTech – technology explained for everyone. Original: https://velstech.net/setup-domain*
