This guide walks you through:
- Registering a domain on Namecheap
- Pointing it to your VPS IP
- Configuring Nginx with
sites-available - Securing it with free SSL via Certbot
1. Register a Domain on Namecheap
-
Go to Namecheap and purchase a domain.
-
In Domain List → Manage → Advanced DNS, add these records:
- Root domain (
@) → your VPS IP - Subdomain (
www) → your VPS IP
- Root domain (
Example:
Host: @ | Value: <your-vps-ip> | TTL: Automatic
Host: www | Value: <your-vps-ip> | TTL: Automatic
👉 Test after a few minutes with:
ping yourdomain.com
2. Install Nginx on Your VPS
SSH into your VPS:
ssh user@<your-server-ip>
sudo apt update && sudo apt install nginx -y
Verify it’s running:
systemctl status nginx
Default page is available at http://<your-vps-ip>.
3. Configure Firewall (UFW)
Allow web traffic and secure the firewall:
sudo ufw allow 'Nginx Full'
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status
4. Create Nginx Config for Your Domain
Inside /etc/nginx/sites-available, create a file for your domain:
sudo nano /etc/nginx/sites-available/yourdomain.com
Paste this basic config:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
root /var/www/html;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
Enable it by linking to sites-enabled:
sudo ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Now http://yourdomain.com should work.
5. Secure with SSL (Certbot + Let’s Encrypt)
Install Certbot:
sudo apt install certbot python3-certbot-nginx -y
Run Certbot:
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
Follow prompts:
- Enter your email
- Accept terms
- Choose redirect HTTP → HTTPS
Certbot updates your config automatically.
Test auto-renew:
sudo certbot renew --dry-run
6. Verify HTTPS
Visit:
You should see the secure lock icon 🔒.
✅ Done!
- Domain registered on Namecheap
- DNS pointed to VPS
- Nginx configured with
sites-available/sites-enabled - Free SSL certificate installed with Certbot
🎉 Your VPS is now serving a domain with HTTPS!
👉 Next step: host multiple domains or subdomains on the same VPS using Nginx server blocks.
Read more
Next.js App on a VPS (Hetzner) in traditional way
Clone your repo, install Node, build your Next.js app, run it on a custom port, and keep it alive with PM2.
How to Enable the Classic Android Navigation Bar in BlueStacks 5 (Back / Home / Recents)
Enable the classic Android navigation bar (Back, Home, and Recent buttons) in BlueStacks 5 by editing a hidden configuration file. Step-by-step guide for developers and testers.
Set Up an Expo Build Local Environment on WSL2
Set up a full Expo and Android build environment on WSL2 Ubuntu 24.04. Install Android SDK, NDK, Java 17, Node 20, EAS CLI, and configure all environment variables.
