When I decided to build my personal website, I didn’t want:
- No-code builders
- Managed hosting
- Black-box platforms
I wanted control.
This part covers every step from buying a domain to serving your website securely over HTTPS on a VPS.
Architecture Overview
graph TD
A[Domain - GoDaddy] -->|A record → VPS IP| B[DNS]
B --> C[Ubuntu VPS - Hostinger]
C --> D[Nginx]
D --> E[Static Website - /var/www/domain]
Step 1 — Buy a Domain
I bought rayeen.in from GoDaddy.
Immediately after purchase:
- Go to DNS Management
- Remove any default A record pointing to Website Builder or Parking
- Add the following records:
| Type | Host | Points to | TTL |
|---|---|---|---|
| A | @ | YOUR_VPS_IP | 600 |
| CNAME | www | rayeen.in | 600 |
The CNAME is optional but recommended.
Verify:
ping rayeen.in
It should return your VPS IP.
Step 2 — Buy a VPS (Hostinger)
I went with Hostinger VPS — affordable, solid performance, and gives you full root access.
When purchasing:
- Choose a plan that fits your needs (even the cheapest tier works for a personal site + a few services)
- Select Ubuntu as the OS (I went with Ubuntu 22.04)
- Pick a data center closest to your target audience
- During setup, set a root password or add your SSH public key
Once provisioned, Hostinger gives you a VPS IP address — this is what you’ll point your domain to.
Copy that IP. You’ll need it for the DNS A record (Step 1) and for SSH access next.
Step 3 — Prepare the VPS
SSH into your server:
ssh root@YOUR_VPS_IP
Update the system:
apt update && apt upgrade -y
Install required software:
apt install nginx docker.io docker-compose ufw certbot python3-certbot-nginx -y
Enable the firewall:
ufw allow OpenSSH
ufw allow 'Nginx Full'
ufw enable
We only expose ports 22, 80, and 443. No other ports.
Step 4 — Remove Default Nginx Site
Ubuntu ships with a default catch-all config. Remove it to prevent routing conflicts later:
rm /etc/nginx/sites-enabled/default
rm /etc/nginx/sites-available/default
systemctl reload nginx
Step 5 — Create Website Directory
mkdir -p /var/www/rayeen.in
nano /var/www/rayeen.in/index.html
Add test HTML:
<h1>Hello from Rayeen's VPS</h1>
Step 6 — Create Nginx Server Block
Create the config:
nano /etc/nginx/sites-available/rayeen
Add:
server {
listen 80;
server_name rayeen.in www.rayeen.in;
root /var/www/rayeen.in;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
Enable it:
ln -s /etc/nginx/sites-available/rayeen /etc/nginx/sites-enabled/
nginx -t
systemctl reload nginx
Now test by visiting http://rayeen.in.
Step 7 — Add HTTPS (Let’s Encrypt)
Install the certificate:
certbot --nginx -d rayeen.in -d www.rayeen.in
Choose redirect to HTTPS when prompted.
Now https://rayeen.in serves your site with a valid SSL certificate. You have a production-grade static site.
What We Achieved
- Domain → VPS routing
- Clean Nginx setup with no default catch-all
- HTTPS enforced via Let’s Encrypt
- Firewall configured (only 22, 80, 443)
- Production-ready static hosting
This is a real foundation. But manual deployments? That’s technical debt. In Part 2, we set up GitHub Actions for automatic deployment on every push.