Getting a subdomain for free

Understanding Custom Domains and DNS

Custom domains give your self-hosted services professional URLs instead of IP addresses. This guide covers getting free subdomains and configuring them properly.

Free Subdomain Options

Option 1: FreeDNS (Afraid.org)

Advantages:

  • Hundreds of domains to choose from
  • Built-in DDNS support
  • Completely free
  • No ads

Setup Steps:

  1. Visit FreeDNS
  2. Create a free account
  3. Go to Subdomains > Add
  4. Choose from available domains (e.g., yourname.mooo.com)
  5. Enter your VPS IP address
  6. Save

Option 2: DuckDNS

Advantages:

  • Simple setup
  • Great DDNS client
  • Clean interface

Setup:

  1. Visit DuckDNS
  2. Sign in with any social account
  3. Choose a subdomain (e.g., yourname.duckdns.org)
  4. Add your VPS IP

Option 3: No-IP

Advantages:

  • Reliable service
  • Good documentation
  • Mobile apps available

Setup:

  1. Visit No-IP
  2. Create free account
  3. Create hostname
  4. Install DDNS client (optional)

Configuring DNS Records

Basic A Record

Points your domain to an IP address:

Type: A
Name: @ (or subdomain)
Value: 123.456.78.90
TTL: 3600

CNAME Record

Creates an alias to another domain:

Type: CNAME  
Name: www
Value: @
TTL: 3600

Using Cloudflare with Free Domains

Even with free subdomains, you can proxy through Cloudflare:

Step 1: Add Domain to Cloudflare

  1. Log into Cloudflare
  2. Add your domain
  3. Get Cloudflare nameservers

Step 2: Update Nameservers

At your domain provider:

  1. Find DNS settings
  2. Replace nameservers with Cloudflare’s
  3. Wait 24-48 hours for propagation

Step 3: Configure Records

Type: A
Name: @
IPv4: Your VPS IP
Proxy: Enabled (orange cloud)

Benefits:

  • Free SSL certificates
  • DDoS protection
  • CDN caching
  • Analytics

Setting Up DDNS (Dynamic DNS)

If your VPS IP changes, use DDNS to auto-update:

Install ddclient

sudo apt install ddclient -y

Configure for FreeDNS

Edit /etc/ddclient.conf:

protocol=dyndns2
use=web
server=freedns.afraid.org
login=your-username
password=your-password
yoursubdomain.mooo.com

Configure for Cloudflare

protocol=cloudflare
use=web
server=api.cloudflare.com/client/v4
login=token
password=your-api-token
zone=yourdomain.com
yourdomain.com

Test and Enable

# Test configuration
sudo ddclient -daemon=0 -debug -verbose -noquiet

# Enable service
sudo systemctl enable ddclient
sudo systemctl start ddclient

# Check status
sudo systemctl status ddclient

SSL Certificates with Let’s Encrypt

Install Certbot

sudo apt install certbot python3-certbot-nginx -y

Generate Certificate

sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

Auto-Renewal

Certbot automatically sets up renewal. Test it:

sudo certbot renew --dry-run

Multiple Subdomains

Host multiple services with subdomains:

blog.yourdomain.com → 10.0.0.2:3456
api.yourdomain.com → 10.0.0.2:3457  
app.yourdomain.com → 10.0.0.2:3458

NGINX Configuration

Create separate configs for each:

# /etc/nginx/sites-available/blog
server {
    listen 443 ssl;
    server_name blog.yourdomain.com;
    
    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
    
    location / {
        proxy_pass http://10.0.0.2:3456;
        proxy_set_header Host $host;
    }
}

Troubleshooting

Domain not resolving

  • Check DNS propagation: nslookup yourdomain.com
  • Wait up to 48 hours for changes
  • Clear DNS cache: ipconfig /flushdns (Windows) or sudo systemd-resolve --flush-caches (Linux)

SSL certificate errors

  • Ensure domain points to correct IP
  • Check firewall allows port 80 (for verification)
  • Verify NGINX is running

DDNS not updating

  • Check ddclient logs: sudo journalctl -u ddclient -f
  • Verify credentials
  • Test API access manually

Best Practices

  1. Use Cloudflare proxy for added security
  2. Enable automatic SSL renewal
  3. Set up monitoring for domain availability
  4. Keep DDNS credentials secure
  5. Use separate subdomains for different services
  6. Document your DNS configuration

Conclusion

With free subdomains and proper DNS configuration, you can give your self-hosted services professional URLs without spending money on domains. Combined with SSL certificates and DDNS, you have a robust, production-ready setup.

Logo

© 2026 Martin Munguia