If you've built a website and are wondering βHow do I make this live with a custom domain like mywebsite.com
?β β this guide is for you.
In this tutorial, youβll learn everything from buying a domain name to pointing it to your server and hosting your website. Whether you're deploying a simple static site or a full-stack app, Iβll walk you through both beginner-friendly and advanced approaches.
π Step 1: Buy a Domain Name
To get started, you need to purchase a domain name β your digital address on the internet.
β Where to buy:
- Namecheap
- GoDaddy
- Google Domains (Now migrated to Squarespace)
- Cloudflare Registrar
π‘ Tips:
- Choose a
.com
,.net
, or a country-specific TLD like.lk
for Sri Lanka. - Keep it short, brandable, and easy to remember.
Once purchased, youβll gain access to DNS settings β this is where youβll connect the domain to your server or hosting provider.
π§βπ» Step 2: Choose Your Hosting Platform
There are many hosting platforms available depending on your tech stack and needs.
π Static Site (HTML, CSS, JS):
βοΈ Dynamic / Full-Stack App (Node.js, Python, etc.):
- Render
- DigitalOcean
- Heroku
- AWS EC2
- Railway
- Self-hosted VPS with Nginx or Apache
For this guide, Iβll show two deployment paths:
- With Vercel
- With a custom VPS using Nginx
π Step 3: Connect Domain to Hosting Provider
β Option A: Assign a Domain on Vercel or Netlify (Easy)
On Vercel:
- Go to your Vercel dashboard > Select your project.
- Click on Settings > Domains.
- Add your domain (e.g.,
yourdomain.com
). - Vercel will give you DNS records to add.
On Domain Registrar:
- Go to your domain registrar (e.g., Namecheap).
- Find DNS settings for your domain.
- Add a CNAME record or A record provided by Vercel.
- Save changes and wait for DNS to propagate (up to 24 hrs, usually quicker).
Once propagation is done, your domain will start pointing to your Vercel app!
β Option B: Point Domain to a Custom VPS (Advanced)
Letβs say you have a server (VPS) on DigitalOcean or AWS.
- Get your public IP address (e.g.,
142.93.123.12
) - Go to your Domain DNS settings
- Add an A Record:
-
Host:
@
- Type: A
- Points to: Your server's IP
- TTL: Automatic or 30 mins
For subdomains like www
or app.domain.com
, add a separate A or CNAME record.
π¦ Step 4: Deploy Your Website to the Server
Static Site (VPS example):
Upload your files to /var/www/html
or a custom directory.
scp -r ./your-website-files user@your-server-ip:/var/www/yourdomain.com
Node.js App Example:
- Clone your app to your VPS:
git clone https://github.com/your/repo.git
cd repo
npm install
- Run using PM2:
npm install -g pm2
pm2 start server.js
π Step 5: Setup Nginx as a Reverse Proxy (Optional but Recommended)
If you're using Node.js or another backend, set up Nginx to route traffic to your app.
Sample Nginx config:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
location / {
proxy_pass http://localhost:3000; # your backend port
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
- Save this to
/etc/nginx/sites-available/yourdomain
- Create a symlink:
ln -s /etc/nginx/sites-available/yourdomain /etc/nginx/sites-enabled/
- Test and restart Nginx:
sudo nginx -t
sudo systemctl restart nginx
π Step 6: Secure Your Site with HTTPS (Free SSL)
Use Letβs Encrypt via Certbot.
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx
Certbot will guide you to:
- Select your domain
- Automatically configure SSL
- Enable HTTPS access
Your website will now be accessible securely at https://yourdomain.com
.
π Optional: Set Up Domain Email (e.g., info@yourdomain.com)
Use providers like:
- Zoho Mail (Free tier available)
- Google Workspace
- ProtonMail (Custom domain support)
You'll need to update MX Records in your domain DNS to enable email.
β Final Checklist
Step | Status |
---|---|
Domain Purchased | β |
Hosting Platform Chosen | β |
Domain Connected (DNS) | β |
App Deployed | β |
Nginx Configured (optional) | β |
SSL/HTTPS Enabled | β |
π§ Final Thoughts
Assigning a domain and hosting your site may seem daunting at first, but it's actually a straightforward process once you understand the flow:
- Domain β DNS setup
- App β Hosting or VPS
- Reverse Proxy & SSL β Production-ready
Once youβve done it a couple of times, it becomes second nature.
Let me know if you'd like a separate article on CI/CD, Dockerizing apps, or domain email integration next!
π¬ Letβs Connect!
Did you just launch your site? Drop your link in the comments!
Or follow me for more:
- DevOps
- JavaScript
- React & Node
- Freelancing & Career tips
Top comments (0)