Skip to main content

Excourse: Domains and Subdomains

Before installing your first application, it's important to understand subdomains - they're how you'll access different services on your server.server, while your domain itself (www.myWebsite.com) should maybe point to your website that you create with WordPress. This chapter explains what subdomains are and how to set them up with your hosting provider.

What is a Subdomain? (Simple Explanation)

A subdomain is like a separate address within your main website. Think of it as different rooms in the same house - each room has its own purpose, but they're all part of the same building.

Examples of subdomains:

  • vault.myinfinitytools.com - For your password manager
  • files.myinfinitytools.com - For your file storage
  • blog.myinfinitytools.com - For your website
  • admin.myinfinitytools.com - For your admin panel

Breaking Down a Subdomain

Let's look at vault.myinfinitytools.com:

  • vault - This is the subdomain (the "room")
  • myinfinitytools - This is your domain name (the "house")
  • com - This is the top-level domain (the "neighborhood")

Why Do We Need Subdomains?

Subdomains help organize your services and make them easier to access:

  • Easy to remember - vault.mydomain.com is clear
  • Professional looking - Each service has its own address
  • SSL certificates work better - Each subdomain gets its own certificate
  • Easy to manage - You can move services around easily

Without subdomains: You'd have to use ports like mydomain.com:8080 or mydomain.com:3000 - much harder to remember!

Common Subdomain Patterns

Here are some common subdomain names for different services:

Security Services

  • vault.mydomain.com - Password manager (Vaultwarden)
  • admin.mydomain.com - Admin panel
  • vpn.mydomain.com - VPN access

File and Storage Services

  • files.mydomain.com - File storage (Nextcloud)
  • sync.mydomain.com - File synchronization
  • backup.mydomain.com - Backup management

Web and Content Services

  • blog.mydomain.com - Blog or website (WordPress)
  • docs.mydomain.com - Documentation
  • wiki.mydomain.com - Knowledge base

Monitoring and Analytics

  • stats.mydomain.com - Analytics (Matomo)
  • monitor.mydomain.com - Server monitoring
  • status.mydomain.com - Status page

How to Create Subdomains

The process varies by hosting provider, but the general steps are the same. You need to create DNS records that point your subdomains to your server's IP address.

Step 1: Get Your Server's IP Address

First, you need to know your server's IP address. You can find this in your server provider's dashboard or by running this command on your server:

curl ifconfig.me

This will show you your server's public IP address (something like 123.456.789.012).

Step 2: Access Your DNS Management

Log into your domain registrar or hosting provider and look for:

  • DNS Management
  • DNS Settings
  • Domain Management
  • Name Servers

Provider-Specific Instructions

Hetzner Cloud

If you bought your domain through Hetzner or are using Hetzner DNS:

  1. Log into your Hetzner Cloud Console
  2. Go to DNS in the left menu
  3. Select your domain from the list
  4. Click "Add Record"
  5. Choose "A Record"
  6. Enter your subdomain name (e.g., vault)
  7. Enter your server's IP address
  8. Click "Save"

Example: To create vault.myinfinitytools.com:

  • Name: vault
  • Type: A
  • Value: 123.456.789.012 (your server IP)

Cloudflare

If you're using Cloudflare for DNS:

  1. Log into your Cloudflare Dashboard
  2. Select your domain
  3. Go to DNSRecords
  4. Click "Add record"
  5. Choose "A" record type
  6. Enter your subdomain name
  7. Enter your server's IP address
  8. Set TTL to "Auto"
  9. Click "Save"

Namecheap

If you bought your domain through Namecheap:

  1. Log into your Namecheap account
  2. Go to Domain List
  3. Click "Manage" next to your domain
  4. Go to the "Advanced DNS" tab
  5. Click "Add New Record"
  6. Choose "A Record"
  7. Enter your subdomain name in the Host field
  8. Enter your server's IP address in the Value field
  9. Set TTL to "Automatic"
  10. Click the Save icon

GoDaddy

If you're using GoDaddy:

  1. Log into your GoDaddy account
  2. Go to My Products
  3. Find your domain and click "DNS"
  4. Click "Add" in the Records section
  5. Choose "A" record type
  6. Enter your subdomain name in the Name field
  7. Enter your server's IP address in the Value field
  8. Set TTL to "1 Hour"
  9. Click "Save"

Understanding DNS Propagation

After creating a subdomain, it takes time for the change to spread across the internet. This is called DNS propagation.

How Long Does It Take?

  • Usually: 5-30 minutes
  • Sometimes: Up to 24 hours
  • Rarely: Up to 48 hours

How to Check if It's Working

You can test if your subdomain is working by visiting it in your browser:

  • Go to https://vault.yourdomain.com
  • If you see a page (even an error), the subdomain is working
  • If you get "This site can't be reached", it's still propagating

Testing with Command Line

You can also test from your server:

# Test if subdomain resolves
nslookup vault.yourdomain.com

# Test if it points to your server
dig vault.yourdomain.com

Planning Your Subdomains

Before installing applications, plan which subdomains you'll need:

Essential Subdomains

These are the most common ones you'll need:

  • vault.yourdomain.com - Password manager
  • files.yourdomain.com - File storage
  • blog.yourdomain.com - Website or blog
  • admin.yourdomain.com - Admin panel (optional)

Optional Subdomains

You might want these later:

  • sync.yourdomain.com - File synchronization
  • stats.yourdomain.com - Analytics
  • monitor.yourdomain.com - Server monitoring
  • backup.yourdomain.com - Backup management

Best Practices

Naming Conventions

  • Use descriptive names - vault instead of app1
  • Keep them short - files instead of file-storage-system
  • Use lowercase - vault not Vault
  • Avoid special characters - No spaces, symbols, or accents

Security Considerations

  • Don't use obvious names - Avoid admin for sensitive services
  • Use random names for sensitive services - a7b9c2 instead of admin
  • Document your subdomains - Keep a list of what each one does

Troubleshooting

Subdomain Not Working

If your subdomain isn't working:

  1. Check the DNS record - Make sure it points to the right IP
  2. Wait for propagation - Give it 30 minutes to an hour
  3. Check for typos - Make sure the subdomain name is correct
  4. Test with different tools - Try nslookup or online DNS checkers

Common Mistakes

  • Including the full domain - Use vault not vault.mydomain.com
  • Wrong IP address - Make sure you're using your server's public IP
  • Wrong record type - Use "A" record, not "CNAME" for IP addresses
  • Not saving the record - Make sure to click "Save" after creating

Quick Reference

Find your server IP:

curl ifconfig.me

Test subdomain resolution:

nslookup vault.yourdomain.com

Test from browser:

https://vault.yourdomain.com

You're Ready!

Now you understand subdomains and how to create them! This knowledge will be essential as you install applications like Vaultwarden, Nextcloud, and WordPress.

What you learned:

  • What subdomains are - Separate addresses for different services
  • Why they're useful - Organization, SSL, and professional appearance
  • How to create them - DNS records with your hosting provider
  • How to test them - Browser and command-line methods
  • Best practices - Naming conventions and security

Next step: You're now ready to install your first application! In the next chapter, we'll install Vaultwarden and use the subdomain you just created.

What You Learned

  • Subdomains - Separate addresses for different services on your domain
  • DNS Records - How to point subdomains to your server
  • DNS Propagation - How long it takes for changes to take effect
  • Testing Methods - How to verify subdomains are working
  • Planning - How to organize your services with subdomains

You now have the foundation knowledge needed to set up professional-looking, organized services on your server!


Next: Installing Vaultwarden - Your Password Manager (Chapter 5)