TL;DR: Setting up a VPS for apps takes about two dozen commands on a server that costs about €8 a month. Half of them lock the server down, and you do those once. The other half turn it into an app host, and those keep coming back with every new app and every deploy.
- Server: 2 vCPU and 4 GB of RAM with Ubuntu 26.04 LTS, from Netcup or Hetzner.
- Lock it down: SSH keys, a sudo user, no password or root logins,
ufwwith ports 22, 80 and 443, and automatic security updates with reboots. - Watch out: ports you publish with Docker skip
ufw, so never publish a database port. - Host apps: Docker with log rotation, one Caddy container for HTTPS, and every app on a private Docker network.
- Deploy: by hand it's pull, build, replace, with a few seconds of downtime each time.
- Skip the app half: Ployz does builds, HTTPS and push-to-deploy with one command. Your coding agent can run it, and every deploy, restart or delete your agent asks for waits for you to approve.
A VPS (virtual private server) is a slice of a physical server with its own share of CPU, RAM and disk, rented by the month. Setting one up means making it safe to leave on the internet, then giving it a way to run and update your apps.
Which steps can you skip?
The server half is the same whatever tool you use. The app half is the part a deploy tool can take over.
| Task | Do it yourself | With Ployz |
|---|---|---|
| Rent a server | Netcup or Hetzner console | Same: Ployz runs on the server you rent |
| Ubuntu, SSH keys, sudo user | A few commands, once | Same |
| Turn off password logins, firewall | Edit one SSH file, four ufw commands | Same |
| Security updates and reboots | unattended-upgrades, plus a reboot now and then | Same |
| Backups | Yours | A restore point for each database; move a database to another server in a click |
| Build the app | Write a Dockerfile, run docker build | Railpack builds Node, Python, Ruby, PHP, Go, Rust, Java and Elixir without a Dockerfile |
| HTTPS | Install Caddy, write a Caddyfile, point DNS | ployz up gives the app an HTTPS address. Custom domains are included. |
| Several apps on one server | A Docker network and one Caddyfile block per site | Each app is a service; services reach each other by private DNS name |
| Deploys | git pull, rebuild, restart, a few seconds of errors | Push to GitHub. With a health check set, the new version must pass it before the old one stops. |
| Logs | docker logs, plus log rotation in daemon.json | Searchable logs in the dashboard, build logs in deploy history |
| Monitoring | A separate tool | Metrics and searchable logs for every service and server |
| Databases | docker run postgres with a volume | One-click Postgres, Redis, MySQL, MongoDB |
Step 1: Rent a server
Start with 2 vCPU and 4 GB of RAM, which runs a couple of web apps plus Postgres comfortably. Move up to 4 vCPU and 8 GB when the database grows or you add a fourth or fifth app.
| Server | Specs | Monthly price | Traffic | Source |
|---|---|---|---|---|
| Netcup VPS 500 | 2 vCPU, 4 GB RAM, 64 GB SSD | €8.26 incl. VAT (12-month term) | Included | netcup VPS |
| Netcup VPS 1000 | 4 vCPU, 8 GB RAM, 128 GB SSD | €14.50 incl. VAT (12-month term) | Included | netcup VPS |
| Hetzner CX23 (Germany, Finland only) | 2 vCPU, 4 GB RAM, 40 GB NVMe | €5.49 / $6.49 + IPv4, excl. VAT | 20 TB | Hetzner price adjustment |
| Hetzner CX33 (Germany, Finland only) | 4 vCPU, 8 GB RAM, 80 GB NVMe | €8.49 / $9.99 + IPv4, excl. VAT | 20 TB | Hetzner price adjustment |
| Hetzner primary IPv4 | €0.50 (about $0.60) | Hetzner docs |
Pick Netcup for a server you'll keep for a year or one with users in the US: it has more disk for the money and datacenters in Europe, Singapore and Manassas. Pick Hetzner if you're trying things out, because it bills by the hour with a monthly cap and a CX23 is about $7 with its IPv4 address. Hetzner's prices are from its 15 June 2026 price rise. More in Hetzner pricing and Hetzner vs DigitalOcean.
Pick Ubuntu 26.04 LTS as the OS. It came out in April 2026 and gets five years of standard security updates, so you won't be forced to upgrade before 2031 (release cycle). It installs security updates on its own, Docker supports it (Docker on Ubuntu), and almost every guide assumes Ubuntu. Debian is a fine second choice. Avoid non-LTS releases on a server, because they're supported for nine months. The commands below also work on 24.04.
Step 2: Log in with an SSH key
Make a key on your laptop and paste the public half into your provider's console when you create the server, so it never has a root password worth guessing.
ssh-keygen -t ed25519 -C "laptop"
cat ~/.ssh/id_ed25519.pub # paste this into the provider's SSH key field
Ed25519 is the key type Ubuntu's OpenSSH docs recommend. If the server already exists with a password, ssh-copy-id root@your-server-ip copies the key over.
Log in and bring everything up to date:
ssh root@your-server-ip
apt update && apt upgrade -y
Step 3: Create a sudo user
Make one normal user with sudo rights and log in as that from now on. A typo as root has no safety net, and with root logins off, a bot guessing usernames has one more thing to get right. It's the step most quick-start videos skip.
adduser deploy # pick a password; sudo will ask for it
usermod -aG sudo deploy
rsync --archive --chown=deploy:deploy ~/.ssh /home/deploy
The last line copies root's authorized_keys to the new user, so your key works for both. Now open a second terminal and check that ssh deploy@your-server-ip and sudo whoami work. Keep the root session open until the next step is done; it's your way back in if something goes wrong.
Step 4: Turn off password and root logins
Put three settings in a file under /etc/ssh/sshd_config.d/, check it, restart SSH, then confirm the live values. The last check matters because some cloud images ship their own file that turns passwords back on.
sudo tee /etc/ssh/sshd_config.d/10-hardening.conf <<'EOF'
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no
EOF
sudo sshd -t && sudo systemctl restart ssh
sudo sshd -T | grep -Ei 'passwordauthentication|kbdinteractive|permitrootlogin'
The file name starts with 10- for a reason. Ubuntu puts Include /etc/ssh/sshd_config.d/*.conf at the top of sshd_config (Ubuntu docs), and for each setting "the first obtained value will be used" (sshd_config manual). Files load in name order, so yours has to sort before something like 50-cloud-init.conf. Password and keyboard-interactive logins are both on by default in OpenSSH, so you do need to set them.
If a tool needs to connect as root with a key, use PermitRootLogin prohibit-password instead of no. It blocks root passwords but allows root keys.
Step 5: Open ports 22, 80 and 443 in the firewall
Allow SSH first, then turn ufw on. Ubuntu ships ufw but leaves it off, because it "by default is initially disabled" (Ubuntu firewall docs).
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status verbose
Enable it before allowing 22 and you lock yourself out. If that happens, Netcup and Hetzner both have a web console you can log in through.
Docker skips ufw. In Docker's words: "When you publish a container's ports using Docker, traffic to and from that container gets diverted before it goes through the ufw firewall settings" (Docker docs). So docker run -p 5432:5432 postgres puts your database on the internet whatever ufw says. Publish ports only on the reverse proxy, because containers on the same Docker network reach each other without it. Or bind to localhost with -p 127.0.0.1:5432:5432. On Hetzner you can also add a free Cloud Firewall, which filters traffic outside your server, so Docker can't route around it.
Step 6: Turn on automatic security updates and reboots
Ubuntu installs security updates by itself through unattended-upgrades, but it doesn't reboot, so kernel fixes don't take effect until you restart. Ubuntu's automatic updates docs say security updates are on "right after installation" and Automatic-Reboot defaults to false.
Check it's on:
cat /etc/apt/apt.conf.d/20auto-upgrades
# should show: APT::Periodic::Unattended-Upgrade "1";
sudo dpkg-reconfigure -plow unattended-upgrades # turns it on if it isn't
To let it reboot at 4 a.m. when an update needs it, set these two lines in /etc/apt/apt.conf.d/50unattended-upgrades:
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "04:00";
Logs go to /var/log/unattended-upgrades. Only security updates install automatically. Everything else, and the move to the next LTS in a few years, you do by hand.
That's the server half: about twenty commands, once, and then mostly reboots.
Step 7: Install Docker with log rotation
Run each app as a container. Containers keep apps from fighting over language versions, restart on boot, and run the same on your laptop and the server. Docker's convenience script installs it in two commands (Docker's Ubuntu install page):
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Then change one setting, because Docker doesn't rotate logs and a chatty app will fill the disk:
echo '{ "log-driver": "local" }' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
Docker's logging docs say "by default, no log-rotation is performed" and recommend the local driver because it "performs log-rotation by default". The setting applies to containers created after the restart. Read logs with docker logs -f app1.
A database runs the same way, with a volume so the data survives restarts. Running Postgres yourself is cheap, and the backups are on you; more in Postgres hosting.
Step 8: Host several apps behind Caddy with HTTPS
Put every app on one Docker network, don't publish their ports, and run one reverse proxy on 80 and 443 that routes by domain name. Caddy is the easiest: one block per site, and it gets and renews certificates by itself.
docker network create web
docker run -d --name app1 --network web --restart unless-stopped my-app:latest
docker run -d --name app2 --network web --restart unless-stopped my-other-app:latest
A Caddyfile:
app.example.com {
reverse_proxy app1:3000
}
blog.example.com {
reverse_proxy app2:8080
}
Caddy is the only container with published ports:
docker run -d --name caddy --network web --restart unless-stopped \
-p 80:80 -p 443:443 \
-v $PWD/Caddyfile:/etc/caddy/Caddyfile \
-v caddy_data:/data \
caddy:2
Caddy's automatic HTTPS docs list what it needs: the domain's A/AAAA records point to your server, ports 80 and 443 are open, and its data directory is "writeable and persistent" (the caddy_data volume). Then it "keeps all managed certificates renewed and redirects HTTP to HTTPS automatically." Add a site by adding a block and running docker exec caddy caddy reload --config /etc/caddy/Caddyfile.
On 4 GB, a handful of small Node, Python or PHP apps plus one Postgres is normal, and memory runs out before CPU. Run docker stats to see what each uses.
Step 9: Deploy updates
By hand it's pull, build, replace:
cd ~/my-app && git pull
docker build -t my-app:latest .
docker rm -f app1
docker run -d --name app1 --network web --restart unless-stopped my-app:latest
That works, but for a few seconds Caddy has nothing to send traffic to. If the new version crashes on start, your site is down until you notice. Avoiding that takes two containers, a health check and a switch.
Most people wrap this in a script, then a GitHub Action that runs it over SSH, then a second container for zero downtime, then secrets. This is the half that grows: every new app means a Dockerfile, a Caddyfile block and a deploy script.
Where Ployz fits
Steps 7 to 9 are the half that keeps growing, so I built Ployz to replace them with one command. Do steps 1 to 6 first, then run this from your laptop:
ployz up --server root@your-server
It installs Ployz, builds the current directory and gives it an HTTPS address. Connect your GitHub repo and every push builds on your server. Node, Python, Ruby, PHP, Go, Rust, Java and Elixir need no Dockerfile.
Or paste Read ployz.dev/agents.md and deploy this repo to my server. into Claude Code, Codex or Cursor. Your agent deploys, and every deploy, restart or delete your agent asks for waits for you to approve.
Ployz is free on any number of servers. Set up your VPS with Ployz.
FAQ
How much does a VPS cost per month?
A VPS big enough for a few apps and a database costs €8 to €15 a month at Netcup or $7 to $11 at Hetzner. That's 2 to 4 vCPU and 4 to 8 GB of RAM.
Do I need fail2ban on a VPS?
Not really, once passwords are off. Bots still knock on port 22 all day, but they can't guess a key, so fail2ban mostly keeps your logs quieter. If you want it, sudo apt install fail2ban is enough, because the Debian package Ubuntu uses turns on the SSH jail by default (defaults-debian.conf). Check it with sudo fail2ban-client status sshd.
Is a VPS worth it compared to a platform?
For most solo developers with a database, yes. A small app with a web service, a worker and Postgres costs $23 to $72 a month on Heroku, Railway, Fly.io and Render, and about $7 on a rented server (the hidden costs of PaaS). A VPS also has no usage meter: €8.26 whether the app is quiet or busy. My first month on Laravel Cloud was about $600, Railway ran me $500+ a month, mostly a busy database, and today one €80 dedicated server set up this way runs everything.
When should I stay on a platform instead?
Stay on a platform if you have one small app, no database and no wish to ever SSH into anything. At that size the entry plans are cheap, and you skip both halves of this guide.
How I checked
I checked every fact on 2026-10-01 against Ubuntu's, Docker's, Caddy's, OpenSSH's, Hetzner's and Netcup's own pages, linked next to each claim. The commands are for Ubuntu 26.04 LTS and also work on 24.04. Server prices come from each provider's price page; Hetzner's exclude VAT and Netcup's include German VAT.
Skip the app half and let your coding agent deploy with Ployz, free on any number of servers. Get started.