Zum Inhalt

Webserver – Caddy LXC

Setup-, Betriebs- und Support-Dokumentation für epping-haus.de

1. Zweck und Architektur

Der LXC 150 stellt den öffentlichen Webzugriff für epping-haus.de bereit. Caddy übernimmt TLS/HTTPS und Routing. Neben Website und DokuWiki werden MkDocs und code-server betrieben.

2. System

Parameter Aktueller Stand
Proxmox Container-ID 150
Hostname web
Betriebssystem Debian GNU/Linux 13.6 amd64
LXC unprivileged
CPU 2 Cores
RAM 2048 MB
Swap (Proxmox) 1024 MB
LAN-IP 192.168.178.150/24
Gateway / DNS 192.168.178.10

3. DNS und Netzwerk

Die öffentliche IPv4-Adresse wird dynamisch über PPPoE bezogen. Den aktuellen Wert bitte per DynDNS- oder DNS-Prüfung ermitteln.

Hostname DNS
epping-haus.de A → dynamische öffentliche IPv4
www.epping-haus.de CNAME → epping-haus.de.
docs.epping-haus.de CNAME → epping-haus.de.
edit.docs.epping-haus.de CNAME → docs.epping-haus.de.

OpenWrt: TCP/443 → 192.168.178.150:443; TCP/25 und TCP/80 → Mailcow 192.168.178.146.

4. Caddy

Dieser Container übernimmt den externen HTTPS-Zugriff und verteilt Anfragen an die internen Dienste. Die Hauptfunktion ist das sichere und zentrale Routing für Website, Dokumentation und Admin-Endpoints.

Verwandte Seiten

docs.epping-haus.de {

    reverse_proxy 127.0.0.1:8080

}

edit.docs.epping-haus.de {

    reverse_proxy 127.0.0.1:8443

}

MkDocs-Lesezugriff per Login

Nur docs.epping-haus.de kann mit Basic Auth geschützt werden. edit.docs.epping-haus.de bleibt beim code-server-Login.

docs.epping-haus.de {

    basic_auth {

        berthold <PASSWORT-HASH>

    }

    reverse_proxy 127.0.0.1:8080

}

Hash:

caddy hash-password

Danach:

caddy validate --config /etc/caddy/Caddyfile
systemctl reload caddy

Der Aktivierungsstatus des Basic-Auth-Schutzes wurde im vorliegenden Verlauf noch nicht abschließend live bestätigt.

5. DokuWiki

wiki.epping-haus.de verwendet PHP 8.4-FPM. Geschützt sind /data/, /conf/, /bin/, */inc/, /vendor/ und /install.php**.

6. MkDocs

Parameter Wert
Projekt /opt/mkdocs/site
Quellen /opt/mkdocs/site/docs
Konfiguration /opt/mkdocs/site/mkdocs.yml
Ausgabe /opt/mkdocs/site/site
Virtualenv /opt/mkdocs/venv
MkDocs 1.6.1
Python 3.13
URL https://docs.epping-haus.de/
Lokaler Port 127.0.0.1:8080

Dienst: mkdocs.service.

7. code-server

Parameter Wert
Version 4.137.0
Benutzer berthold
Konfiguration /home/berthold/.config/code-server/config.yaml
Bind 127.0.0.1:8443
HTTPS aus
URL https://edit.docs.epping-haus.de/

In code-server: File → Open Folder → /opt/mkdocs/site/docs. Das Passwort wird nicht dokumentiert.

8. Automatischer MkDocs-Build

Der Dienst mkdocs-autobuild.service überwacht /opt/mkdocs/site/docs mit inotifywait.

Speichern in code-server

→ inotify

→ mkdocs build --clean

→ /opt/mkdocs/site/site

→ Caddy

→ https://docs.epping-haus.de/
systemctl status mkdocs-autobuild.service --no-pager
journalctl -u mkdocs-autobuild.service -n 30 --no-pager

9. Berechtigungen

chown -R berthold:berthold /opt/mkdocs/site
sudo -u berthold /opt/mkdocs/venv/bin/mkdocs build --clean -f /opt/mkdocs/site/mkdocs.yml

10. Verifikation

systemctl status caddy --no-pager

systemctl status mkdocs.service --no-pager

systemctl status mkdocs-autobuild.service --no-pager

systemctl status code-server@berthold --no-pager

curl -I https://docs.epping-haus.de/

curl -I https://docs.epping-haus.de/webserver-caddy-lxc/

curl -I https://edit.docs.epping-haus.de/

Ohne Basic Auth: docs.epping-haus.de → HTTP 200. Mit aktivem Basic Auth ohne Login → HTTP 401. code-server → typischerweise HTTP 302 → ./login.

11. Fehlerbehebung

code-server: Cannot reconnect

Ursache war das ursprüngliche 512-MB-LXC-Limit und der OOM-Killer. Lösung: 2 CPU-Cores und 2048 MB RAM.

MkDocs: PermissionError

Root-Builds erzeugten Dateien als root:root. Lösung: Projekt als berthold betreiben und Builds nicht als root ausführen.

Caddyfile-Formatwarnung

Nicht fatal. Prüfen mit:

caddy validate --config /etc/caddy/Caddyfile

12. Schnellreferenz