Hosting this site on a Raspberry Pi
The page you're reading is coming from a Raspberry Pi 4 sitting on my home network. Here's how it's put together.
The goal
I wanted two things from one small computer: network-wide ad blocking for every device in the house, and a public website I fully control. And I wanted to do it without opening ports on my router or exposing my home IP address.
The pieces
- Raspberry Pi OS Lite (64-bit), with no desktop, set up headless. The Pi has never had a keyboard or monitor attached.
- Docker Compose runs everything as three containers, defined in one file.
- Pi-hole is the DNS server for my network and quietly drops requests to ad and tracking domains.
- Caddy serves these plain HTML and CSS files.
- Cloudflare Tunnel makes an outbound connection from the Pi to Cloudflare. Visitors hit Cloudflare, and Cloudflare passes the request down the tunnel. Nothing on my router is open to the internet.
How a request gets here
you ──https──▶ Cloudflare ──tunnel──▶ cloudflared ──▶ Caddy ──▶ these files
(on the Pi)Cloudflare handles HTTPS certificates. The tunnel is encrypted on its own, and Caddy only has to speak plain HTTP inside the Pi.
Locking it down
- SSH accepts keys only. Password logins are off.
- A firewall only allows connections from the home network.
- Security updates install automatically.
- Pi-hole is never exposed publicly. An open DNS resolver on the internet gets abused for amplification attacks almost immediately.
What it costs
The domain, about ten dollars a year, plus a few watts of electricity. Cloudflare's free plan covers the rest.
The site is deliberately simple: hand-written HTML, one stylesheet, no JavaScript, no trackers, and nothing loaded from anywhere else.