Home server, advanced: run it like a pro
One front door with HTTPS, containers that can't do much damage, networks that keep secrets apart, a server you can rebuild from Git, and alerts for the failures that make no noise.
Last updated December 2, 2026.
Before you start
This guide continues the intermediate guide. You should already have Docker Compose stacks in /srv/stacks, app data on its own disk, nightly restic backups (with a tested restore) and Tailscale.
An intermediate server survives accidents. An advanced server is easy to reason about: it has one front door, services that can't talk to things they shouldn't, a configuration you can rebuild from scratch, and alerts that tell you when something silently stops. That is what we build:
- A reverse proxy with HTTPS and friendly local names instead of
ip:port. - Alerts for silence: know when a backup stopped running, not only when a website is down.
- Hardened containers and isolated networks, so one compromised app can't reach everything.
- Your whole setup in Git, and a recovery drill you actually run.
- Optional: redundant storage (RAID 1) for less downtime.
Step 1: One front door with HTTPS and local names
Remembering 192.168.1.50:8096 doesn't scale. A reverse proxy listens on ports 80 and 443 and sends each name to the right container: jellyfin.home.arpa goes to Jellyfin, kuma.home.arpa to Uptime Kuma. It also gives every app HTTPS, so passwords never cross your network in plain text.
We will use Caddy because its configuration is tiny. home.arpa is the name reserved for home networks, so it never collides with a real website.
mkdir -p /srv/stacks/caddy && cd /srv/stacks/caddy
docker network create proxy
nano compose.yamlservices:
caddy:
image: caddy:2
container_name: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- /srv/appdata/caddy/data:/data
- /srv/appdata/caddy/config:/config
networks: [proxy]
networks:
proxy:
external: trueThen list your services in the Caddyfile. tls internal makes Caddy create its own private certificate authority, which is perfect for a network you control:
kuma.home.arpa {
tls internal
reverse_proxy uptime-kuma:3001
}
jellyfin.home.arpa {
tls internal
reverse_proxy jellyfin:8096
}Each app joins the same proxy network. In its own compose.yaml, remove the ports: lines (the proxy is now the only way in) and add:
networks: [proxy]
networks:
proxy:
external: trueLast piece: teach your network the names. In your local DNS (Pi-hole: Local DNS Records; most routers have a similar page) point every name to the server's LAN address. Then copy Caddy's root certificate and install it on your devices once, so browsers trust it:
docker cp caddy:/data/caddy/pki/authorities/local/root.crt ./caddy-root.crtStep 2: Alerts for silence
A monitor that checks "is the website up?" catches loud failures. The nastier ones are silent: the backup script stopped running three weeks ago, the UPS lost its connection, the disk filled up. Nothing is down, so nothing alerts.
The fix is a dead man's switch: the job reports "I'm fine" every time it finishes, and you get an alert when the report doesn't arrive. Uptime Kuma can do this with a Push monitor: create one, set the heartbeat to a little more than the job's interval (for a nightly job, 26 hours), and copy its push URL.
Then add one line at the end of your backup script, so it only reports success if restic succeeded:
restic -r $REPO backup /srv/appdata /srv/stacks && \
curl -fsS -m 10 "http://127.0.0.1:3001/api/push/YOUR_TOKEN?status=up&msg=backup-ok" > /dev/nullIf the backup fails, the server is off, or cron stops, no heartbeat arrives and Kuma sends you a message. Use the same trick for anything periodic: certificate renewals, apt updates, a weekly restore check.
Step 3: Harden your containers
A container is not a fortress by default. A few lines in each compose file limit what a compromised app can do:
user: "1000:1000" # don't run as root (if the image supports it)
read_only: true # the container can't change its own files
tmpfs: [/tmp] # ...except a scratch folder in memory
cap_drop: [ALL] # drop every extra Linux privilege
security_opt: ["no-new-privileges:true"]
mem_limit: 512m # a runaway app can't eat all your RAM
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3001"]
interval: 60s
retries: 3Not every image works with every option: some need to write somewhere (give them a volume or a tmpfs) or need one capability back (cap_add). Add the options one at a time, run docker compose up -d, read docker compose logs, and keep what works.
- Pin versions.
image: postgres:16instead oflatest; for important apps, a specific tag such as1.23.16. Update on purpose, after a backup. - Never mount the Docker socket (
/var/run/docker.sock) into an app unless you fully trust it: whoever controls it controls the whole server. - Secrets in files, not in the compose. Use
.envwithchmod 600, or Docker secrets for apps that support them.
Step 4: Isolate your networks
Inside Docker
A database should talk to its app and nobody else, and it should have no route to the internet. Docker can enforce that with an internal network:
services:
app:
image: your-app:1.0
networks: [proxy, backend]
db:
image: postgres:16
networks: [backend] # only on the internal network
networks:
proxy:
external: true
backend:
internal: true # no way out to the internetInside your house
Cheap smart plugs, cameras and TVs rarely get security updates. Don't let them share a network with your server and your laptop. Most routers offer a guest network or VLANs: put untrusted devices there, with "isolate clients" enabled, and keep a trusted network for your computers and the server.
Smart-home devices that must be controlled from the server (for example through Home Assistant) can live on their own network if you allow only that single connection from the server to them, never the other way around.
Step 5: Your server as code
If the server died today, could you rebuild it from memory? The goal here is that your compose files are the documentation, and they live in Git, so you can go back to any previous working version.
cd /srv/stacks
git init
printf '.env\n*.key\n' > .gitignore # NEVER commit secrets
git add . && git commit -m "First snapshot of my stacks"Put a copy in a private repository (your own Git server such as Forgejo or Gitea, or a private repository on a hosting service). For every .env file, commit a .env.example with the variable names and fake values, so you remember what each one is for.
Then write a short README.md in the same repository: your disks, what mounts where, how the backup works, and the exact commands to bring everything back. That file is your runbook, and the next step puts it to the test.
Step 6: The recovery drill
A backup you haven't restored is a hope; a rebuild you haven't tried is a bigger one. Once a quarter, simulate losing the system disk, without touching your real server:
- Take a spare disk, a spare PC or a virtual machine, and install the same Linux with Docker.
- Clone your Git repository to
/srv/stacksand recreate your.envfiles from your password manager. - Restore the data from restic:
restic -r /mnt/backup/restic restore latest --target /(on the test machine, with the backup disk attached). - Start one stack at a time with
docker compose up -dand open each app. Check that your data is really there: a photo, a recent note, a login. - Write down every surprise in your runbook: a missing package, a forgotten password, a step that took ten minutes of guessing.
Time yourself. "My whole server is back in 90 minutes, from a laptop and a backup disk" is a very comfortable sentence to be able to say.
Step 7 (optional): Redundant storage with RAID 1
RAID 1 mirrors two disks, so the server keeps running when one dies. It does not replace backups: it only reduces downtime. Do this after everything above, and only with two disks of similar size.
sudo apt install mdadm -y
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdX /dev/sdY
cat /proc/mdstat # watch the first sync
sudo mkfs.ext4 -L data /dev/md0
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
sudo update-initramfs -uMount it by UUID in /etc/fstab with nofail, as in the intermediate guide. Then make a failure visible: check cat /proc/mdstat ([UU] means both disks are fine, [U_] means one is gone) from a script that reports to your push monitor, so a degraded array alerts you instead of waiting for the second disk to die.
If something goes wrong
- The name doesn't open: check the DNS record first (
nslookup kuma.home.arpa), thendocker compose logs caddy. - The browser warns about the certificate: the device doesn't trust Caddy's root certificate yet. Install
caddy-root.crton it. - A container won't start after hardening: remove the options and add them back one by one; the logs usually name the file it can't write.
- The app can't reach its database: both must share a network (
backend); the app also needsproxyif Caddy must reach it. - The push monitor alerts but the job ran: the heartbeat interval is shorter than the job's schedule, or the
curlline never executed because a command before it failed.
You now run your home server the way small teams run theirs. From here the best next steps are the ones that fit your life: more services, a second site for backups, or sharing what you learned.