Skip to content
david shin Technical case studies

Technical case studiesSelf-hosting & infrastructure / 2026

A website, served from home

A Raspberry Pi, nginx, and Cloudflare Tunnel: taking a static site from a local folder to the public internet without opening router ports.

My contribution
Built a static site and deployment workflow for a Raspberry Pi, exploring nginx and Cloudflare Tunnel.
Demonstrated result
Static exports upload over SSH; an outbound tunnel exposes the local web server without router port forwarding.
Demo status
Home-hosted experiment using a temporary tunnel. Stable hosting requires a named tunnel and managed services.

I wanted to understand what happens after a website leaves my laptop. This project puts the hosting infrastructure in reach: a Raspberry Pi at home, static files on disk, and a Cloudflare Tunnel that makes them accessible online.

From source code to the Pi

The site uses Next.js with output: "export", producing HTML, CSS, JavaScript, and assets in an out/ directory. The Pi only needs to serve those files; it does not need a running Next.js server. Features that require a server runtime would need a different deployment.

My deployment command builds locally, checks that out/index.html exists, then uploads the output to ~/webapps/myapp/ on the Pi using rsync over SSH. A failed build stops the upload. This keeps the build work on my development machine and makes updating the Pi a single command.

How a request reaches nginx

In the nginx setup, nginx serves the exported files from the deployment directory. The separate cloudflared process connects out from the Pi to Cloudflare and forwards incoming requests to nginx’s local HTTP listener.

Visitor's browser
  → HTTPS → Cloudflare
  → outbound-established tunnel → cloudflared on the Pi
  → local HTTP → nginx
  → static files in ~/webapps/myapp/

The tunnel avoids router port forwarding and does not require publishing my home IP address in a DNS record. Cloudflare handles the visitor-facing HTTPS connection; nginx handles the local file serving. The site is still public—the tunnel is a route to it, not an authentication layer.

The first version used Python’s http.server bound to 127.0.0.1:8080. nginx takes over that file-serving role; the tunnel must point to whichever local port nginx actually listens on.

The lesson: a running process is not a service

A temporary Cloudflare Quick Tunnel provides a generated trycloudflare.com address. It is convenient for sharing an experiment, but stopping the tunnel takes the site offline at that address, and restarting generally gives it a new URL.

I also learned the boundary of tmux: detaching keeps the web server and tunnel running after a terminal disconnect. Closing their panes or rebooting the Pi does not. The next reliability step is to run nginx and cloudflared as systemd services and use a named tunnel with a stable hostname on a domain managed through Cloudflare.

This is a home-hosted experiment, not a high-availability deployment. Power, internet access, and process lifetime are part of the application now. That is the value of the project: seeing the build, deployment, web server, and network path as one working system.

Next project

Next Watch

Entertainment / Discovery