How to Create and Configure Subdomains: A Step-by-Step Guide

Published: March 15, 2026 | Author: Editorial Team | Last Updated: March 15, 2026
Published on subdoms.com | March 15, 2026

Creating a subdomain involves two main steps: adding a DNS record for the subdomain, and configuring your web server to handle requests to it. The exact process varies by hosting provider and server software, but the underlying concepts are universal.

Step 1: Add a DNS Record

Log in to wherever you manage your domain's DNS — your domain registrar (Namecheap, GoDaddy, Google Domains), your hosting control panel (cPanel, Plesk), or your DNS provider (Cloudflare, Route 53). Navigate to the DNS management area for your domain and add a new record.

For most use cases, create an A record with the subdomain prefix as the Name/Host field and the server's IP address as the Value. Example: Name = "blog", Value = "192.0.2.1", TTL = 3600. If you want the subdomain to point to another hostname (like a hosting service's domain), use a CNAME record instead: Name = "blog", Value = "your-server.hosting-provider.com".

DNS propagation: After adding a DNS record, changes take time to propagate globally — typically 15 minutes to a few hours, though TTL values affect this. Use tools like dnschecker.org to verify propagation across multiple geographic locations before troubleshooting server issues.

Step 2: Configure Your Web Server

Nginx server block: Add a new server block in your Nginx configuration: server {{ listen 80; server_name blog.example.com; root /var/www/blog; index index.html; }}. Reload Nginx after changes: sudo nginx -s reload.

Apache virtual host: Add a VirtualHost block: <VirtualHost *:80> ServerName blog.example.com DocumentRoot /var/www/blog </VirtualHost>. Enable with a2ensite and reload Apache.

cPanel hosting: Many shared hosting providers offer a "Subdomains" section in cPanel where you can create a subdomain by entering the prefix, selecting the parent domain, and specifying a document root directory. cPanel handles both DNS and server configuration automatically.

Step 3: Enable HTTPS

Each subdomain requires its own SSL certificate (or a wildcard certificate covers them all). With Let's Encrypt/Certbot: sudo certbot --nginx -d blog.example.com obtains and installs a free certificate. A wildcard certificate (*.example.com) covers all subdomains but requires DNS validation during issuance. For high-volume subdomain creation (multi-tenant apps), wildcard certificates are essentially mandatory.

Verifying Your Setup

Test DNS resolution: dig blog.example.com or nslookup blog.example.com should return the expected IP address. Test HTTP connectivity: curl -I http://blog.example.com should return a 200 or appropriate redirect. Check SSL: curl -I https://blog.example.com should show a valid certificate in the response headers.

Learn about subdomain SEO considerations or explore our DNS lookup tools to check subdomain configurations.

← Back to Blog | Home

Subscribe to Our Newsletter

Join 10,000+ subscribers. Get expert insights delivered weekly.

No spam. Unsubscribe anytime.