VPS Deploy

Rent a tiny computer in a warehouse. It’s yours.

▶ the lesson · narrated sketch video · tap for sound

the intro

A VPS is a Linux machine you fully control: you install the runtime, configure nginx to route traffic, and run your app with a process manager. More work than a platform, but you understand every layer — and it costs a few dollars a month.

fun fact ✦

Most VPS instances are just Linux boxes in a warehouse — probably in Oregon.

the docs

the deep dive

the ideas behind the video — concepts, diagrams, a walkthrough and the traps to avoid

A VPS is a real Linux machine with your name on the root password — every layer from kernel config upward is yours to run, and yours to break. That responsibility is the feature: after one week of hosting yourself you will understand nginx, systemd, and port 443 in a way no tutorial can teach. It is the cheapest way to buy real intuition, at roughly one coffee a month.

you own every layer, including the mistakes

internetnginxapp (systemd)postgres
requests flow down the layers; only nginx faces the internet

key terms

reverse proxy

nginx sits in front of your app: terminates TLS, routes domains to local ports, serves static files fast.

proxy_pass http://localhost:3000

SSH key

A key pair replacing passwords: the public half lives on the server, the private half never leaves your laptop.

ssh-keygen -t ed25519

systemd unit

A small config that turns your app into a managed service: auto-restart, start on boot, logs in journald.

Restart=always

fail2ban

Watches auth logs and firewall-bans IPs that fail login too often. The bots never stop knocking.

maxretry 5, then ban

how it works

  1. 1
    Update and add a user

    apt update && apt upgrade, then create a non-root user with sudo. Root is for the installer, not for daily use.

  2. 2
    Harden SSH

    Put your public key on the server, then disable password login entirely. Bot traffic drops from a storm to silence.

  3. 3
    Turn on the firewall

    ufw default deny incoming, then allow 22, 80, and 443. Every other port stays dark to the internet.

  4. 4
    Put nginx in front

    nginx listens on 80 and 443, handles certificates, and proxies to your app on localhost. One public door, camera on it.

  5. 5
    Keep it alive

    A systemd unit restarts the app on crash and on reboot; fail2ban watches the door. journalctl -u app shows the logs.

the code, explained

the unit file that babysits your app

1[Service]
2ExecStart=/usr/bin/node /srv/app/server.js
3WorkingDirectory=/srv/app
4Restart=always
crash? systemd restarts it within seconds
5User=deploy
never run your app as root
6
7[Install]
8WantedBy=multi-user.target
this is what makes it start on boot

side by side

VPS

  • full root control
  • flat cost, a few dollars
  • runs anything you install
  • you patch and secure it
VS

managed platform

  • push to deploy
  • patching handled for you
  • limited runtimes and quotas
  • price climbs with traffic
⚠️ watch out

If your app listens on 0.0.0.0:3000, anyone can skip nginx and hit it directly — no TLS, no rate limiting, no logging. Bind to 127.0.0.1 and let nginx be the only public door.

quick answers

What size VPS do I need?

A $5-6 box (1 vCPU, 1GB RAM) comfortably runs a small app plus a database if you add swap. Upgrade when metrics — not vibes — say so.

Why did strangers try to log in within an hour?

Bots scan the entire IPv4 range nonstop; an unprotected sshd collects hundreds of password guesses a day. Keys only, passwords off, fail2ban on.

nginx or Caddy?

Caddy gets automatic HTTPS with near-zero config, which is lovely. nginx is more ubiquitous, better documented for edge cases, and the skill transfers everywhere.

quick hits about VPS Deploy

short answers · interviews, tips, trivia & hidden gems

🎤 interview

What is a VPS?watch ↗

📚 tutorial

The first VPS checklistwatch ↗

🔧 useful

SSH keys over passwords, alwayswatch ↗

💎 deep

Your app starts on bootwatch ↗

🔧 useful

Bots will knock. Do not answer.watch ↗

💎 deep

Test config before prod finds outwatch ↗