Engineering notes

Self-hosting on a VPS: a practical end-to-end guide

How to self-host on a VPS end to end. Size the server, harden SSH, run services in Docker behind an HTTPS reverse proxy, keep admin panels off the internet, patch, back up, monitor and control cost.

By Vozora · Published

Self-hosting on a VPS comes down to a short list of jobs: pick a size that fits what you will run, lock down login, run each service in a way that survives a reboot, put HTTPS in front of anything public, keep admin tools private, apply updates, back up to somewhere else, watch it from outside, and keep an eye on what it costs. None of it is difficult. Most self-hosting trouble comes from skipping one of these jobs, not from getting one of them slightly wrong.

This guide walks through each job in order, with commands you can run. Where it shows output from a real server, that is a Vozora Nano as it was then (1 vCPU, 1 GB RAM, 20 GB disk; a Nano is now 1 vCPU, 2 GB RAM, 30 GB) running Debian in the UK, captured on 21 September 2026 for our new VPS checklist. The server's address is replaced with $IP. Third-party behaviour is quoted from each project's own documentation, with the date we checked it.

Nothing here is specific to one provider, except where a section says so.

1. Choose a size you will not have to fight

Size the server for the services you actually plan to run, measured rather than guessed. If you have not picked a provider yet, choosing a VPS for self-hosting lists what to check first. The short version from our RAM sizing guide for self-hosting:

  • One or two light services, such as a static site behind a reverse proxy, a WireGuard endpoint or Uptime Kuma, fit in 1 GB with swap as a buffer.
  • An application with its own database, or a handful of containers that each do real work, is where 2 GB and 4 GB start to matter.
  • Plan with MemAvailable, not MemFree. On the fresh Nano, MemAvailable was 714348 kB of 991160 kB total before anything was installed.

Disk matters too. Container images, logs and database files all land under /var by default, and backups need scratch space while they run. On the same fresh server, the whole root filesystem used 3.3G:

$ sudo du -xh / --max-depth=1 2>/dev/null | sort -h | tail -5
4.4M	/etc
72M	/boot
1.1G	/usr
1.2G	/var
3.3G	/

Leave room. A disk that fills up stops databases writing and can stop the package manager finishing an upgrade halfway.

On Vozora the sizes by RAM are Nano 2 GB, Small 4 GB, Medium 8 GB and Large 16 GB, with specifications on the pricing page. An hourly server can be resized to a larger size while it is stopped, but not down to a smaller one, and monthly-subscription servers cannot be resized yet. That is one more reason to measure first, and one more reason to have the backups described below: a tested restore is also a migration plan.

2. First login and SSH hardening

Log in as the image's login user with your SSH key, then use sudo. On Vozora the key is installed for the image login user shown on Overview → Connect, not root, and direct root SSH is not enabled. The Debian image user is debian. See managing SSH keys for adding keys and choosing which one a new server gets.

A public address is found quickly. On the Nano, the first login attempt for a username that does not exist came 27 minutes and 3 seconds after first boot, and there were 70 by the time we checked:

$ sudo journalctl -u ssh --no-pager | grep -c 'Invalid user'
70

$ sudo journalctl -u ssh --no-pager | grep -oP 'Invalid user \K\S+' | sort | uniq -c | sort -rn | head -3
      8 ubuntu
      6 test
      6 deploy

That is background noise if passwords cannot work. Prove it from your own machine by refusing to offer a key:

$ ssh -o PubkeyAuthentication=no debian@$IP
debian@$IP: Permission denied (publickey).

If the list in brackets includes password or keyboard-interactive on any server you run, set PasswordAuthentication no in the SSH daemon configuration before doing anything else. When you change SSH configuration:

sudo sshd -t                 # syntax check; prints nothing if the config is valid
sudo systemctl reload ssh    # the unit is "ssh" on Debian, "sshd" on AlmaLinux

Keep your current session open and test the change from a second terminal before you close it. A typo in sshd_config with no open session is how people lock themselves out.

Do not enable root login to work around a key problem. If a key is refused, check the username and which key the server was built with; troubleshooting SSH covers the usual causes. Tools such as fail2ban reduce log noise from the attempts above. They do not replace key-only login.

3. Two firewalls, and why Docker ignores one of them

There are two places to filter traffic, and it is worth using both.

Outside the server. A Vozora firewall is a named set of inbound rules that you put servers in, managed from the dashboard. Every account has one called default, which new servers join, and it starts open: it allows all traffic until you remove its two allow-everything rules and add the ones you need, or put the server in a firewall of your own. The firewall guide covers it.

On the server. A host firewall such as ufw on Debian or firewalld on AlmaLinux. Before writing rules, look at what is listening. On the fresh Nano:

$ sudo ss -tlnp
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0      4096      127.0.0.54:53        0.0.0.0:*    users:(("systemd-resolve",pid=777,fd=23))
LISTEN 0      4096         0.0.0.0:5355      0.0.0.0:*    users:(("systemd-resolve",pid=777,fd=12))
LISTEN 0      4096   127.0.0.53%lo:53        0.0.0.0:*    users:(("systemd-resolve",pid=777,fd=21))
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*    users:(("sshd",pid=651,fd=6))
LISTEN 0      4096            [::]:5355         [::]:*    users:(("systemd-resolve",pid=777,fd=14))
LISTEN 0      128             [::]:22           [::]:*    users:(("sshd",pid=651,fd=7))

Port 22 is SSH. Port 53 on 127.0.0.x is the local DNS stub and only answers the machine itself. Port 5355 is LLMNR from systemd-resolved, bound to every address. If you do not use it, set LLMNR=no in /etc/systemd/resolved.conf and restart systemd-resolved, or make sure a firewall drops it. Rerun ss -tlnp after every install. Anything bound to 0.0.0.0 or [::] listens on every address.

Then the catch. Docker publishes container ports by writing its own packet filtering rules, and its documentation is blunt about the effect: "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, packet filtering and firewalls, checked 2026-09-25). And on publishing in general: "Publishing container ports is insecure by default. Meaning, when you publish a container's ports it becomes available not only to the Docker host, but to the outside world as well." (Docker docs, port publishing, checked 2026-09-25).

The fix is on the same page: include the loopback address 127.0.0.1 in the publish flag, as in -p 127.0.0.1:8080:80, and "only the Docker host can access the published container port." So the rule for a self-hosting box is simple. Publish every container port on 127.0.0.1, and let one reverse proxy be the only thing listening on 80 and 443.

4. Run services with Docker Compose

Docker is not required for self-hosting, but it makes each service one directory with one file, which is easy to back up, move and rebuild. On the Nano we installed it with Docker's convenience script:

$ curl -fsSL https://get.docker.com | sudo sh >/dev/null 2>&1; sudo docker --version
Docker version 29.8.1, build 4a63305

On Ubuntu, our Docker, Nginx and HTTPS guide installs from Docker's own repository and covers the host firewall, the proxy and the certificate, with every step run on a real server.

Give each service its own directory under something like /srv, with a compose.yaml:

# /srv/app/compose.yaml
services:
  app:
    image: your/app:1.4.2          # pin a version, not "latest"
    restart: unless-stopped
    ports:
      - "127.0.0.1:8080:8080"      # loopback only; the proxy reaches it
    volumes:
      - ./data:/data               # state lives next to the compose file
    env_file: .env                 # secrets stay out of the YAML
cd /srv/app
sudo docker compose up -d
sudo docker compose ps
sudo docker compose logs --tail 50

Three habits pay off later:

  • Pin image versions. Upgrades then happen when you change a line, not whenever an image is pulled.
  • Keep state in named paths you know about. A bind mount like ./data puts the data next to the compose file, so /srv is the thing to back up.
  • Set a restart policy. Anything you start by hand with no restart policy or unit file will not come back after a reboot.

That last one is worth proving once. After a deliberate reboot of the Nano:

$ uptime -s
2026-09-21 16:59:12

$ sudo docker inspect -f '{{.HostConfig.RestartPolicy.Name}}' kuma
always

$ systemctl is-enabled caddy
enabled

$ sudo docker ps --format '{{.Names}}  {{.Status}}'
kuma  Up 49 minutes (healthy)

The container came back because of its restart policy. Caddy came back because systemd has it enabled.

5. A reverse proxy with HTTPS

One reverse proxy on ports 80 and 443 terminates HTTPS and forwards each hostname to a service on loopback. Caddy is the shortest path, because it handles certificates itself. Its documentation says "By default, Caddy serves all sites over HTTPS" and keeps "all managed certificates renewed", provided your domain's DNS records point to the server, ports 80 and 443 are open externally, and its data directory is writeable and persistent (Caddy docs, automatic HTTPS, checked 2026-09-25).

A Caddyfile for two services:

app.example.com {
	reverse_proxy 127.0.0.1:8080
}

files.example.com {
	reverse_proxy 127.0.0.1:8081
}
sudo caddy validate --config /etc/caddy/Caddyfile
sudo systemctl reload caddy

On the Nano, with a test hostname in place of a real domain, the first HTTPS response came 6 seconds after restarting Caddy. Check which certificate is actually being served rather than trusting the config:

$ echo | openssl s_client -connect <ip-with-dashes>.sslip.io:443 -servername <ip-with-dashes>.sslip.io 2>/dev/null | openssl x509 -noout -issuer
issuer=C=US, O=Let's Encrypt, CN=YE1

If you prefer Nginx, the Docker, Nginx and HTTPS guide walks through Nginx in front of a loopback container with Certbot, including a renewal dry run and a reboot check. Either way, open only 80 and 443 to the world, plus SSH.

Publicly trusted certificates are logged in Certificate Transparency logs, so a new hostname attracts scanners too. HTTPS protects the connection; it does not make the application behind it safe to expose. Anything with a login page that only you use is a candidate for the next section instead.

6. Keep admin panels off the internet

Dashboards, database consoles and monitoring UIs rarely need a public port. Publish them on loopback and reach them over SSH. On the Nano, Uptime Kuma ran on 127.0.0.1:3001. From our own machine:

$ ssh -N -L 3001:127.0.0.1:3001 debian@$IP &

$ curl -sI http://localhost:3001 | head -1
HTTP/1.1 302 Found

$ curl -s -m 5 -o /dev/null -w "%{http_code}\n" http://$IP:3001
000

Through the tunnel, the dashboard answers at http://localhost:3001. Straight at the public address, curl gets no HTTP response within 5 seconds; 000 is what curl prints when there was none. -L forwards a local port to an address as seen from the server, and -N means, in the OpenSSH manual's words, "Do not execute a remote command. This is useful for just forwarding ports." (OpenBSD manual, ssh(1), checked 2026-09-25).

The panel is then only reachable by someone who can already SSH in, which is a far smaller group than everyone who can reach port 443. If several people need access, a VPN such as WireGuard does the same job with less friction than handing out SSH accounts.

7. Updates: packages, reboots and images

Three things need updating, and they update in different ways.

Operating system packages. The Debian image on the Nano already had automatic security updates on:

$ systemctl is-active unattended-upgrades
active

$ cat /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

Reboots. Unattended-upgrades installs a new kernel but does not reboot by default. The option that changes that, in the project's own default configuration file, is commented out and described as "Automatically reboot WITHOUT CONFIRMATION if the file /var/run/reboot-required is found after the upgrade", with a companion Automatic-Reboot-Time setting whose default is "now" (unattended-upgrades, 50unattended-upgrades.Debian, checked 2026-09-25). Either enable it with a quiet time, or check for the file yourself:

[ -f /var/run/reboot-required ] && cat /var/run/reboot-required

The Debian wiki's debugging advice is to run it by hand: sudo unattended-upgrade -d (Debian wiki, UnattendedUpgrades, checked 2026-09-25).

Container images. Unattended-upgrades takes packages from the distribution's archives. It does not touch the software inside your containers. Update those deliberately, per service:

cd /srv/app
# edit the pinned tag in compose.yaml, read the release notes, then:
sudo docker compose pull
sudo docker compose up -d
sudo docker image prune -f      # remove the images this left unused

Take a backup before any upgrade that runs a database migration. Rolling back an image is easy; rolling back a migrated schema is not.

8. Backups you run yourself

Vozora can back up a server's disk: daily backups can be turned on per server and keep the newest 7, and you can take one on demand. Those backups are stored on the same platform as the server, and a copy that lives with the same provider as the server should not be your only one.

A workable plan has four parts: decide what to back up, copy it off the server, keep several versions, and test a restore.

What to back up. Usually /etc and the directory holding your services and their data, for example /srv. Not the whole disk: the operating system and container images can be reinstalled. Databases need a dump rather than a copy of their live files. The PostgreSQL documentation says pg_dump "makes consistent exports even if the database is being used concurrently" (PostgreSQL docs, pg_dump, checked 2026-09-25). The same page notes that for large production databases other approaches may suit better, so read it for anything big.

Where to put it. Somewhere that is not this server and that a compromise of this server cannot erase: another machine you control, storage at a different provider, or a machine at home. restic can write to "Local filesystem", "SFTP", "REST Server", S3-compatible storage, Backblaze B2 and others (restic docs, preparing a new repository, checked 2026-09-25).

restic, end to end. Create the repository once, over SFTP to a backup host that accepts an SSH key belonging to root on this server:

sudo install -m 600 /dev/null /root/.restic-password
sudo sh -c 'openssl rand -base64 32 > /root/.restic-password'
sudo restic -r sftp:backup@backup.example.com:/srv/restic/myserver \
  --password-file /root/.restic-password init

Store that password somewhere other than the server. restic's documentation is explicit: "Losing your password means that your data is irrecoverably lost."

A backup script, /usr/local/sbin/restic-backup, mode 700:

#!/bin/sh
set -eu
export RESTIC_REPOSITORY="sftp:backup@backup.example.com:/srv/restic/myserver"
export RESTIC_PASSWORD_FILE="/root/.restic-password"

# files
restic backup /etc /srv --exclude-caches

# a database dump, streamed straight into the repository
restic backup --stdin-filename app.sql --stdin-from-command -- \
  docker compose -f /srv/app/compose.yaml exec -T db pg_dump -U app app

# keep 7 daily, 4 weekly, 6 monthly; prune removes the data they no longer need
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune

restic check

--stdin-from-command is restic's way to back up a program's output, and it matters that it is used instead of a shell pipe: "A non-zero exit code from the command causes restic to cancel the backup", so a failed dump does not become a snapshot (restic docs, backing up, checked 2026-09-25). forget on its own only removes snapshots from the list; restic's documentation says "two commands need to be called in sequence: forget to remove snapshots, and prune to remove the remaining data", which --prune does in one step (restic docs, removing snapshots, checked 2026-09-25). check tests "whether your repository is healthy and consistent"; add --read-data occasionally to read every pack file, bearing in mind it downloads the lot (restic docs, working with repositories, checked 2026-09-25).

Run it daily with a systemd timer rather than cron, so failures land in the journal:

# /etc/systemd/system/restic-backup.service
[Unit]
Description=restic backup

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/restic-backup
# /etc/systemd/system/restic-backup.timer
[Unit]
Description=Daily restic backup

[Timer]
OnCalendar=daily
RandomizedDelaySec=1h
Persistent=true

[Install]
WantedBy=timers.target
sudo systemctl daemon-reload
sudo systemctl enable --now restic-backup.timer
sudo systemctl start restic-backup.service     # run once now
sudo journalctl -u restic-backup.service -n 30 --no-pager

Persistent=true runs a missed backup at next boot if the server was off when it was due (systemd.timer manual, checked 2026-09-25).

BorgBackup is the other common choice and works the same way in outline: borg init a repository over SSH, borg create archives, borg prune with keep rules such as --keep-daily 7 --keep-weekly 4 --keep-monthly 6. Its documentation says "If some data hasn't changed from one backup to another, Borg can simply reference an already uploaded data chunk (deduplication)", and warns "The repository data is totally inaccessible without the key and the key passphrase. In any case, make a backup of the borg key" (Borg docs, quick start, checked 2026-09-25). Borg over SSH expects Borg on the backup host as well; restic only needs SFTP or object storage there.

Test a restore. A backup you have never restored is a hope. Restore to a scratch directory and look at the files:

sudo -E restic restore latest --target /tmp/restore-test --include /srv/app
ls -la /tmp/restore-test/srv/app

(-E keeps the two RESTIC_ variables if you exported them in your shell.) Better still, restore onto a fresh server once, bring the service up there, and time it. That run is also your migration procedure for the day you outgrow this server.

9. Monitoring from somewhere else

Uptime Kuma describes itself as "an easy-to-use self-hosted monitoring tool", with "90+ notification services" including email, Telegram, Discord and Slack (Uptime Kuma README, checked 2026-09-25). On the Nano we ran it bound to loopback, reached over the SSH tunnel in section 6:

$ sudo docker run -d --restart=always -p 127.0.0.1:3001:3001 -v kuma:/app/data --name kuma louislam/uptime-kuma:1 >/dev/null; sudo docker ps --format '{{.Names}}  {{.Status}}'
Unable to find image 'louislam/uptime-kuma:1' locally
1: Pulling from louislam/uptime-kuma
(layer download progress trimmed)
Status: Downloaded newer image for louislam/uptime-kuma:1
kuma  Up Less than a second (health: starting)

That session used the 1 tag. The README's install command, as checked, uses louislam/uptime-kuma:2; follow the README for a new install. It also warns that "File Systems like NFS (Network File System) are NOT supported", so keep its data on a local volume.

The limitation of any monitor is where it runs. Uptime Kuma on the server it watches cannot tell you that server is down, because it is down too. Either run it on a second machine and point it at the first, or use it on the server to watch other things and have something elsewhere check the server itself.

What to monitor, at minimum:

  • Each public URL, with a keyword check (Uptime Kuma has an HTTP(s) Keyword monitor) so a proxy error page does not count as up.
  • Certificate expiry. Uptime Kuma lists "Certificate info" among its features. Make sure something warns you before a certificate expires, because a failed renewal is quiet until then.
  • The backup. A Push monitor that your backup script calls at the end turns "the backup silently stopped a month ago" into an alert the next day.
  • Disk space, from df -h or a small script, because a full disk breaks everything else on this list.

10. Cost control

A self-hosted server is cheap until something is left running. On Vozora, VPS usage is billed hourly for provisioned time. Charges continue while a server remains provisioned, including while it is powered off; deleting it ends future usage charges. The hourly VPS page sets out current hourly rates and 730-hour estimates.

Hourly servers on Vozora are paid from credit you add in advance, so a forgotten server cannot cost much more than the credit on the account: we email you when it is running low, and stop servers a day after it runs out.

Habits that matter more than any cap:

  • Delete test servers when you are done, after saving anything you need. Powering off does not stop provisioned-time charges.
  • Budget for backup storage. It lives somewhere else, and that somewhere has its own bill.
  • Keep API tokens out of repositories and CI logs. A token that can create servers can spend money.
  • Check the server list when a project ends, not when the invoice arrives.

The short version

  1. Measure MemAvailable and disk, then size; on Vozora an hourly server can be resized up, not down.
  2. Log in as the image user with a key, prove passwords are refused, never enable root login as a workaround.
  3. Filter outside the server and on it, and publish every container port on 127.0.0.1.
  4. One directory and one compose.yaml per service, versions pinned, restart policy set.
  5. One reverse proxy on 80 and 443 with automatic HTTPS; check the issuer.
  6. Admin panels on loopback, reached over ssh -N -L.
  7. Automatic security updates on, a plan for reboots, container images updated on purpose.
  8. restic or Borg to storage you control elsewhere, on a timer, with a tested restore. Vozora's own backups are stored on the same platform as the server.
  9. Monitor from a second place, including the backup and the certificate.
  10. Delete what you are not using.

When you are ready to put this on a server, see Vozora's UK VPS plans.

© 2026 Vozora. A trading name of Bankside Technology Ltd, registered in England and Wales, company no. 17253446. Registered office: First Floor, Swan Buildings, 20 Swan Street, Manchester, England, M4 5JW.