What You'll Learn
Domains & URLs
Servers & Hosting
Databases
Web Tiers Architecture
Static vs Dynamic Sites
Free Hosting Platforms
Paid & VPS Hosting
Deploy Static Sites
Deploy Backend Apps
Custom Domain Setup
Cloudflare Tunnel
Ngrok for Testing
Understanding the Web
Domains & URLs
A domain is your website's address on the internet. It's like your home address but for websites. When someone types www.omkumarpandey.com.np in their browser, DNS (Domain Name System) translates it to an IP address where your website lives.
π‘ Pro Tip
Buy domains from Cloudflare - they sell at wholesale price with no markup! For .np domains, you'll need to register through Nepal's domain registrar.
Servers & Hosting
A server is a computer that stores your website files and serves them to visitors. When someone visits your site, their browser sends a request to the server, which responds with the HTML, CSS, JavaScript, and other files needed to display your page.
Databases
Databases store and organize your application's data - user accounts, blog posts, products, etc. Static sites don't need databases, but dynamic applications do.
Web Tiers Architecture
Modern web applications are built in layers (tiers). Understanding this architecture helps you know what you need for your project and where to host each component.
π― Key Insight
Static sites only need the Frontend tier β FREE hosting available!
Dynamic sites need all 3 tiers β Requires paid hosting or clever free solutions.
Static vs Dynamic Sites
Understanding the difference is crucial for choosing the right hosting solution.
| Feature | Static Sites | Dynamic Sites |
|---|---|---|
| Content | Fixed HTML/CSS/JS files | Generated on each request |
| Backend | β Not needed | β Required |
| Database | β Not needed | β Usually needed |
| User Accounts | β Not possible | β Supported |
| Speed | β‘ Very fast (CDN) | π Depends on server |
| Security | π‘οΈ Very secure | β οΈ More attack vectors |
| Cost | π FREE | π° $5-100+/month |
| Examples | Portfolio, Blog, Docs | E-commerce, Social Media |
Host Static Sites for FREE
If your website is just HTML, CSS, and JavaScript (no backend, no database), you can host it completely FREE on these amazing platforms. Perfect for portfolios, landing pages, and documentation!
GitHub Pages
Host directly from your GitHub repository
FREENetlify
Auto-deploy from Git with custom domains
FREEVercel
Best for Next.js, great for any static site
FREECloudflare Pages
Fast CDN, unlimited bandwidth
FREEFirebase Hosting
Google's hosting with free SSL
FREESurge.sh
Simple CLI-based deployment
FREEDeploy with GitHub Pages
GitHub Pages is the easiest way to host a static site. It's free, supports custom domains, and automatically deploys when you push to your repository.
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/yourusername/your-repo.git
git push -u origin main
1. Go to your repository on GitHub
2. Click Settings β Pages
3. Under "Source", select main branch
4. Click Save
1. In GitHub Pages settings, enter your custom domain
2. Create a CNAME file in your repo with your domain
3. Add DNS records at your domain registrar:
# Add these DNS records:
Type: CNAME
Name: www
Value: yourusername.github.io
# Or for apex domain (A records):
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
Deploy with Netlify
Netlify offers automatic deployments from Git, serverless functions, form handling, and more. It's perfect for modern static sites and JAMstack applications.
1. Go to netlify.com and sign up
2. Click "Add new site" β "Import an existing project"
3. Connect your GitHub account
4. Select your repository
# For plain HTML/CSS/JS:
Build command: (leave empty)
Publish directory: / or ./public
# For React/Vue/Angular:
Build command: npm run build
Publish directory: dist or build
1. Go to Site settings β Domain management
2. Click "Add custom domain"
3. Enter your domain: www.omkumarpandey.com.np
4. Add the DNS records Netlify provides
# DNS Records to add:
Type: CNAME
Name: www
Value: your-site.netlify.app
# Enable HTTPS (automatic with Netlify)
β¨ Netlify Bonus Features
β’ Auto-deploy on every git push β’ Free SSL certificates β’ Form submissions β’ Serverless functions β’ Split testing β’ Deploy previews for pull requests
Deploy with Cloudflare Pages
Cloudflare Pages offers unlimited bandwidth, automatic deployments, and blazing-fast performance through Cloudflare's global CDN network.
# Step 1: Go to Cloudflare Dashboard β https://dash.cloudflare.com β Click "Pages" in sidebar β Click "Create a project" # Step 2: Connect Git Repository β Connect to GitHub/GitLab β Select your repository β Configure build settings: β’ Build command: (empty for static, or npm run build) β’ Output directory: / or dist or build # Step 3: Deploy β Click "Save and Deploy" β Wait for build to complete β Site live at: your-project.pages.dev # Step 4: Custom Domain β Go to your project β Custom domains β Add: www.omkumarpandey.com.np β Cloudflare auto-configures DNS if domain is on Cloudflare!
π Why Cloudflare Pages?
Unlimited bandwidth (even on free tier), 300+ edge locations worldwide, and if your domain is already on Cloudflare, custom domain setup is instant!
Hosting Platforms Overview
Different projects need different hosting solutions. Here's a comprehensive overview of all major hosting options, from free to enterprise-grade.
Free Hosting Platforms
| Platform | Best For | Features | Limitations |
|---|---|---|---|
| GitHub Pages | Static sites | Custom domain, SSL | 1GB storage, no backend |
| Netlify | JAMstack, Static | Functions, Forms, CDN | 100GB bandwidth/mo |
| Vercel | Next.js, Frontend | Edge functions, Fast | 100GB bandwidth/mo |
| Cloudflare Pages | Static + Workers | Unlimited bandwidth! | 500 builds/mo |
| Railway | Full-stack apps | Database, Backend | $5 free credit/mo |
| Render | Web services | Static + Backend | Sleeps after 15min |
| Fly.io | Docker apps | Global deployment | 3 shared VMs free |
Paid & VPS Hosting
AWS
Industry standard, highly scalable
From $5/moGoogle Cloud
Great for ML and big data
From $5/moMicrosoft Azure
Enterprise-grade cloud
From $5/moDigitalOcean
Developer-friendly VPS
From $4/moLinode
Simple, reliable VPS
From $5/moVultr
High-performance cloud
From $2.50/moHeroku
Easy PaaS deployment
From $5/mocPanel Hosting
Traditional shared hosting
From $3/moβ οΈ Important Note
Heroku removed their free tier in 2022. For free backend hosting alternatives, check out Railway, Render, or Fly.io. For testing, use Ngrok or Cloudflare Tunnel!
Deploy Backend Applications
Backend applications (Django, Node.js, FastAPI, Flask) require a server that can run your code. Here are your options from free testing to production deployment.
Backend Frameworks & Deployment
Testing with Ngrok
Ngrok creates a secure tunnel from a public URL to your local machine. Perfect for testing webhooks, sharing work with clients, or mobile app development.
# Install Ngrok # Download from https://ngrok.com/download # Or with npm npm install -g ngrok # Or with snap (Linux) sudo snap install ngrok # Authenticate (get token from ngrok.com) ngrok config add-authtoken YOUR_AUTH_TOKEN # Start your local server first python manage.py runserver 8000 # Django npm run dev -- --port 3000 # Node.js # Expose local server to internet ngrok http 8000 # Output: Forwarding: https://abc123.ngrok.io β http://localhost:8000
π‘ Ngrok Limitations
Free tier: Random URLs that change each session, 40 connections/minute. For permanent URLs, use Cloudflare Tunnel (free) or upgrade Ngrok ($8/mo).
VPS Deployment (Production)
For production Django, Node.js, or FastAPI apps, a VPS gives you full control. Here's a quick overview of deploying a Django app.
# 1. SSH into your VPS ssh root@your-server-ip # 2. Update system sudo apt update && sudo apt upgrade -y # 3. Install required packages sudo apt install python3-pip python3-venv nginx -y # 4. Clone your project git clone https://github.com/yourname/project.git cd project # 5. Create virtual environment python3 -m venv venv source venv/bin/activate pip install -r requirements.txt # 6. Install Gunicorn (WSGI server for Django) pip install gunicorn # 7. Test Gunicorn gunicorn --bind 0.0.0.0:8000 yourproject.wsgi # 8. Configure Nginx as reverse proxy sudo nano /etc/nginx/sites-available/yourproject # 9. Enable site and restart Nginx sudo ln -s /etc/nginx/sites-available/yourproject /etc/nginx/sites-enabled sudo systemctl restart nginx # 10. Set up SSL with Certbot (Let's Encrypt) sudo apt install certbot python3-certbot-nginx -y sudo certbot --nginx -d yourdomain.com
Cloudflare Tunnel (Detailed Guide)
Cloudflare Tunnel lets you expose your local server to the internet with a custom domain, SSL, and DDoS protection - all for FREE! Perfect for hosting Django, Node.js, or any backend app from your own computer or a local server.
π― What You'll Achieve
By the end of this guide, your local Django/Node.js app running on localhost:8000 will be accessible at https://enyx.omkumarpandey.com.np with full SSL!
sudo apt update
sudo apt install cloudflared
For other systems:
# macOS
brew install cloudflare/cloudflare/cloudflared
# Windows - Download from:
# https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation
cloudflared command available
cloudflared tunnel login
This opens a browser window. Select the domain you want to use (e.g., omkumarpandey.com.np). Your domain must be added to Cloudflare first!
cert.pem created in ~/.cloudflared/
ls ~/.cloudflared
cert.pem visible - ready to create tunnel
cloudflared tunnel create enyx-tunnel
Replace enyx-tunnel with any name you want for your tunnel.
cloudflared tunnel list
enyx-tunnel listed
cloudflared tunnel route dns enyx-tunnel enyx.omkumarpandey.com.np
This automatically creates a CNAME record in your Cloudflare DNS pointing to your tunnel.
nano ~/.cloudflared/config.yml
Add the following configuration:
β οΈ Important
Replace YOUR_USERNAME with your actual Linux username, and use the
actual tunnel ID from step 4 for the credentials file path!
# For Django
python manage.py runserver 0.0.0.0:8000
# For Node.js/Express
node app.js # or npm start
# For FastAPI
uvicorn main:app --host 0.0.0.0 --port 8000
Open a new terminal window (keep your app running) and start the tunnel:
cloudflared tunnel run enyx-tunnel
Add your tunnel domain to Django's allowed hosts:
For Node.js/Express: No special configuration needed!
For FastAPI: Configure CORS if needed.
https://enyx.omkumarpandey.com.np
π Congratulations!
Your local application is now live on the internet with:
β
Custom domain
β
Free SSL certificate
β
DDoS protection
β
Cloudflare CDN
Run Tunnel as a Service (Bonus)
To keep the tunnel running even after you close the terminal or reboot, install it as a system service:
# Install cloudflared as a service sudo cloudflared service install # Start the service sudo systemctl start cloudflared # Enable on boot sudo systemctl enable cloudflared # Check status sudo systemctl status cloudflared # View logs sudo journalctl -u cloudflared -f
π‘ Multiple Subdomains
You can route multiple services through one tunnel! Just add more hostnames to your config.yml ingress rules, each pointing to different local ports.
Quick Reference
Hosting Decision Flowchart
Common Commands Cheatsheet
# ===== CLOUDFLARE TUNNEL ===== cloudflared tunnel login # Authenticate cloudflared tunnel create NAME # Create tunnel cloudflared tunnel list # List tunnels cloudflared tunnel route dns NAME SUBDOMAIN # Add DNS cloudflared tunnel run NAME # Start tunnel cloudflared tunnel delete NAME # Delete tunnel # ===== NGROK ===== ngrok http 8000 # Expose port 8000 ngrok http 3000 --subdomain=myapp # Custom subdomain (paid) # ===== NETLIFY CLI ===== npm install -g netlify-cli # Install netlify login # Authenticate netlify deploy # Deploy draft netlify deploy --prod # Deploy production # ===== VERCEL CLI ===== npm install -g vercel # Install vercel login # Authenticate vercel # Deploy vercel --prod # Deploy production # ===== GIT COMMANDS ===== git add . # Stage all files git commit -m "message" # Commit git push origin main # Push to GitHub
π Ready to Deploy?
You now have all the knowledge to host any website - from simple portfolios to complex web applications!
Learn Django Development