How to deploy your first web app to a VPS, step by step
Deploying to a VPS is a great way to learn what platforms usually hide. Here's the general path for a small web app.
1. Create the server Pick a small Linux VPS (Ubuntu or Debian are beginner-friendly). Add your SSH key during setup.
2. Secure the basics
- Log in over SSH and update packages.
- Create a regular user with sudo rights.
- Disable password login for SSH once key login works.
- Turn on a firewall allowing only SSH, HTTP and HTTPS.
3. Install your runtime Node.js, Python, or whatever your app needs. Alternatively, install Docker and run the app in a container.
4. Get your code onto the server
Clone from a Git repository, or copy files with scp/rsync. Install dependencies and set environment variables (never commit secrets to the repo).
5. Keep the app running Use a process manager such as systemd or a Docker restart policy, so the app restarts after crashes and reboots.
6. Put a reverse proxy in front Nginx or Caddy listens on ports 80/443 and forwards to your app's port.
7. Point your domain and add HTTPS Create a DNS A record to the server's IP, then get a free certificate (Caddy does this automatically; with Nginx, Certbot is common).
8. Plan for backups and updates
Which step tripped you up the first time? Would you recommend beginners start with Docker or run the app directly?
Comments · 4
Step 2 is the one people skip and regret. Key-only SSH plus a firewall removes most of the automated noise that hits a fresh server within hours. Caddy is a nice shortcut for step 7 since it handles certificates on its own.
Put a reverse proxy like Caddy or Nginx in front of your app and get automatic HTTPS. Caddy makes that nearly a one-liner.
Tip: before you close your first SSH session after disabling passwords, open a second one to confirm key login works. It saves you from locking yourself out.
Snapshots or backups before every deploy. A VPS gives you lots of freedom, and also lots of ways to break things at 2am.