Deploying a web application on a VPS can feel overwhelming, especially if you’re new to server setup, DNS, and security. In this guide, I’ll walk you through the exact steps I use every time I deploy a real project, from server creation to HTTPS setup, so you can deploy yours quickly and securely.
🧠 Why This Matters
Most tutorials either:
- ✅ focus only on code
- ❌ ignore real deployment steps
- ❌ leave out security essentials
This article covers everything you actually need — not just theory but practical hands-on steps.
🪄 Tools & Requirements
Before we start, prepare:
- A VPS provider (e.g., DigitalOcean, Vultr, or Hetzner)
- A domain name
- SSH client (Terminal / PowerShell / PuTTY)
- Basic knowledge of your app stack (PHP, Node.js, Laravel etc.)
🔌 Step 1: Create & Configure Your VPS
- Choose a Linux distro (Ubuntu 24.04 recommended)
- Create a new server with at least 1GB RAM
- Add a SSH Key (so you don’t use a password)
- Select a region closest to your users
- Launch the instance Once launched, note down your public IP address.
💻 Step 2: Connect via SSH
Open your terminal and run:
ssh root@your_server_ip
If you used a custom user later, replace root with that username.
🛡️ Step 3: Secure the Server
Update packages:
sudo apt update && sudo apt upgrade -y
Create a new user
adduser devuser
usermod -aG sudo devuser
Enable firewall
ufw allow OpenSSH
ufw enable
✅ This blocks everything except SSH.
🌐 Step 4: DNS Setup
Go to your domain provider and add:
Type: A
Host: @
Value: your_server_ip
This points your domain to the VPS. Once propagated, your domain will resolve correctly.
🛠️ Step 5: Install Web Server
For Nginx:
sudo apt install nginx
sudo ufw allow 'Nginx Full'
Check status:
systemctl status nginx
Nginx should now serve a default "Welcome" page.
📦 Step 6: Deploy Your App
Depending on your stack:
PHP / Laravel
Copy code to /var/www/yourapp
Set permissions:
sudo chown -R www-data:www-data /var/www/yourapp
Node.js
Clone repo
Install dependencies:
npm install
pm2 start server.js
Both stacks are easy to manage and scalable.
🔒 Step 7: HTTPS with Let’s Encrypt
Install certbot:
sudo apt install certbot python3-certbot-nginx
Run:
sudo certbot --nginx
Follow prompts — this configures SSL automatically.
📌 Step 8: Testing & Monitoring
✔ Visit https://yourdomain.com
✔ Test every route
✔ Check logs:
sudo tail -f /var/log/nginx/error.log
This ensures everything is working after deployment.
🧠 Finishing Tips
- Always backup your database
- Setup automatic updates
- Learn basics of firewall & SSH hardening
- Monitor uptime with tools like UptimeRobot
Real deployment experience beats tutorials, by practicing these steps you’ll master production servers.
Top comments (0)