Raspberry Pi Mastery

Self-Hosting Web Apps and Services

35 分钟

A Pi makes a good low-power home server for personal tools, dashboards and learning deployments.

A Flask app with Gunicorn

pip install flask gunicorn
gunicorn app:app --workers 2 --bind 127.0.0.1:8000

Run it as a systemd service (previous module) and put a reverse proxy in front.

Docker on the Pi

curl -fsSL https://get.docker.com -o get-docker.sh   # read scripts before running them
sudo sh get-docker.sh
sudo usermod -aG docker $USER

Use ARM64 images (most official images support it). Compose makes multi-service setups easy (see Docker & Containerization).

Popular self-hosted services

Service What it does
Home Assistant home automation hub
Pi-hole / AdGuard Home network-wide ad and tracker blocking
Nextcloud personal cloud storage
Uptime Kuma monitoring dashboard
Mosquitto MQTT broker for IoT devices
Jellyfin media server
WireGuard / Tailscale secure remote access

Reverse proxy and HTTPS

Caddy is the simplest option: it obtains certificates automatically for public domains, or use it with internal certificates on your LAN. Keep services private and reach them over a VPN rather than exposing them to the internet.

Backups

Back up configuration and data (Docker volumes, databases) to another machine or cloud storage on a schedule, and test restoring.

Exercise

Run a small Flask dashboard and Uptime Kuma in Docker Compose on the Pi behind Caddy, reachable from your phone through Tailscale, with nightly backups of their data.

Check yourself

  • Why bind apps to 127.0.0.1 behind a proxy?
  • Why use ARM64 images?
  • How should you reach self-hosted services remotely?

你的进度只保存在此浏览器中。

提交审核(10 积分)