Understanding DNS for Self-Hosted Services
DNS is how your domain name points to your server. A, AAAA, CNAME, TXT records explained — and how to set them up for self-hosting.
What Is DNS?
DNS (Domain Name System) translates domain names (gitea.example.com) into IP addresses (203.0.113.1). When someone visits your self-hosted service, DNS tells their browser which server to connect to.
DNS Record Types
A Record
Points a domain to an IPv4 address.
AAAA Record
Points a domain to an IPv6 address.
CNAME Record
Points a domain to another domain (alias).
TXT Record
Stores text data. Used for verification, SPF, DKIM.
MX Record
Mail server routing.
DNS for Self-Hosting
Single Server, Multiple Services
Point multiple subdomains to the same IP:
Your reverse proxy (Caddy/Traefik) routes based on the hostname.
Wildcard DNS
*.example.com → A → 203.0.113.1
Every subdomain resolves to your server. Combine with wildcard SSL.
DNS Providers
Cloudflare Benefits
TTL (Time to Live)
How long DNS resolvers cache your record. Lower TTL = faster propagation when you change records, but more DNS queries.
DNS is the foundation of self-hosting. Understanding it makes everything else easier.