DNS Configuration Guide: CNAME, A Records & Setup | Nife Docs
Configure DNS records to point your domain to Nife applications.
DNS Basics#
What is DNS?#
DNS (Domain Name System) translates domain names to server addresses:
How It Works#
- You type domain in browser
- Browser queries DNS for address
- DNS resolves domain to target
- Browser connects to application
- Content loads from application
DNS Record Types#
CNAME Record (Recommended)#
Points one domain to another domain:
Format:
When to use:
- โ Mapping subdomains
- โ Flexible failover
- โ Load balancing
- โ Multiple apps
Advantages:
- Can change target easily
- Multiple records point to same target
- No IP address needed
- More flexible
Limitations:
- Cannot use on root domain (@) with some registrars
- Extra DNS lookup
- Slightly slower than A records
A Record#
Points domain to IP address:
Format:
When to use:
- โ Root domain mapping
- โ Direct IP address needed
- โ Simple setup
- โ Some registrars require it
Advantages:
- Fast resolution
- Works for root domain
- Direct IP connection
- One step lookup
Limitations:
- Must update if IP changes
- Less flexible than CNAME
- Not ideal for load balancing
ALIAS Record#
Special record (GoDaddy, some others):
When to use:
- โ Root domain with CNAME-like benefits
- โ When registrar supports it
- โ Flexible root domain mapping
Registrars with ALIAS:
- GoDaddy
- Route 53
- Some others
MX Record#
For email routing:
Use for:
- Email delivery
- Separate from website
Keep separate from:
- Website CNAME records
- Application traffic
Setting Up DNS Records#
Step 1: Log Into Registrar#
Access your domain registrar:
Popular registrars:
- GoDaddy: godaddy.com
- Namecheap: namecheap.com
- Bluehost: bluehost.com
- HostGator: hostgator.com
- Route 53: AWS console
- Cloudflare: cloudflare.com
Step 2: Find DNS Settings#
Navigate to DNS management:
GoDaddy:
Namecheap:
Route 53:
Step 3: Add Record#
Click "Add Record" or similar:
Fill in:
- Name/Subdomain: (e.g., api, www, @)
- Type: CNAME or A
- Value: Target from Nife
- TTL: 3600 or default
- Priority: (if MX record)
Step 4: Save#
Save the DNS record:
- Record saved immediately
- Propagation may take time
- Status may show "pending"
Common DNS Configurations#
Website + Email#
Setup:
Result:
- Email uses MX records
- Website uses CNAME
- Both can coexist
Root Domain#
Option 1: With ALIAS (GoDaddy, Route 53)
Option 2: With A Record
Option 3: Redirect
Multiple Subdomains#
Setup:
Result:
- All subdomains point to application
- Can access via any subdomain
- Same application for all
Load Balancing#
Setup:
Result:
- Traffic distributed
- Failover protection
- Load balanced access
DNS Propagation#
How Propagation Works#
When you make DNS changes:
- Immediate: Changes at registrar
- 5 minutes: Local ISP updates
- 1 hour: Most servers updated
- 24 hours: Complete propagation
Factors affecting speed:
- TTL value (lower = faster)
- ISP caching
- DNS resolver caching
- Server locations
Check Propagation#
Using Terminal:
Using Online Tools:
- MXToolbox.com
- DNSChecker.org
- WhatIsMyIPAddress.com/DNS-Propagation
Result:
Troubleshooting DNS#
Problem: DNS Not Resolving#
Symptoms:
- Domain returns error
- DNS lookup fails
- "Host not found" message
Solutions:
Verify DNS record saved at registrar
Check record name and value
Wait 5-15 minutes for initial propagation
Use online DNS checker
Try flushing DNS cache:
Problem: Old DNS Still Resolving#
Symptoms:
- Old website still loads
- DNS shows old target
- Changes not taking effect
Solutions:
- Wait longer for propagation
- Lower TTL for faster updates
- Check registrar saved changes
- Try different DNS resolver:
- 8.8.8.8 (Google)
- 1.1.1.1 (Cloudflare)
- 208.67.222.222 (OpenDNS)
Problem: Partial Propagation#
Symptoms:
- Works from some locations
- Doesn't work from others
- Inconsistent results
Solutions:
- Completely normal during propagation
- Most locations update within 1 hour
- Wait 24 hours for complete propagation
- No action needed, just wait
DNS Best Practices#
1. Lower TTL Before Changes#
Before making DNS changes:
- Lower TTL to 300-600 seconds
- Wait for propagation
- Make DNS changes
- Propagates faster
- Then increase TTL back to 3600
2. Backup Records#
Keep record of current DNS:
3. Use Descriptive Names#
Use clear subdomain names:
www- main domainapi- API endpointblog- blog sectionstaging- staging environment
4. Document Changes#
Track DNS modifications:
- Date of change
- What changed
- Reason for change
- Who made change
5. Monitor TTL#
Keep appropriate TTL:
- Development: 300-600 seconds
- Production: 3600+ seconds
- Stability: 3600-86400 seconds
6. Separate Concerns#
Keep DNS records organized:
- Web traffic โ CNAME
- Email โ MX records
- Other services โ Separate records
DNS Tools#
Free Checkers#
- DNSChecker.org: Visual checker
- MXToolbox.com: Detailed diagnostics
- WhatsMyDNS.com: Global propagation
- Zonemaster: DNSSEC validation
Command Line#
Registrar Tools#
Most registrars have built-in:
- DNS record checker
- Propagation status
- Record editor
- Export/import features
Next Steps#
- Adding Custom Domains - Setup your domain
- SSL Certificates - Secure your domain
- Monitoring Domains - Track usage
Support#
DNS issues?
- Check sections above
- Use online DNS tools
- Verify records in registrar
- Contact support: [email protected]