stack/landing/Caddyfile
tim 0ddf1d3699 Add RustDesk server and Caddy HTTPS reverse proxy
Proxy forgejo/jellyfin/rustdesk info under devopshomelab.com with
Let's Encrypt, publish RustDesk hbbs/hbbr ports, and wire Forgejo
ROOT_URL to https://forgejo.devopshomelab.com.
2026-07-22 20:00:05 -07:00

81 lines
2.4 KiB
Caddyfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Reverse proxy + LAN landing + automatic HTTPS (Let's Encrypt HTTP-01).
#
# Prerequisites:
# 1. cloudflare-ddns points A records at this host's public IPv4
# 2. Router port-forwards WAN :80 and :443 → this host
# 3. DNS-only (grey cloud) for names used here — orange-cloud breaks HTTP-01 to origin
# 4. Domain is devopshomelab.com (Cloudflare zone). If you meant .org, change all hostnames.
#
# Email for ACME registration (set in compose): CADDY_EMAIL
{
email {$CADDY_EMAIL}
}
# --- HTTPS reverse proxies ---------------------------------------------------
forgejo.devopshomelab.com {
encode gzip
reverse_proxy forgejo:3000
}
jellyfin.devopshomelab.com {
encode gzip
reverse_proxy jellyfin:8096
}
# Info page only — RustDesk clients use TCP/UDP 2111521119, not this site
rustdesk.devopshomelab.com {
encode gzip
header Content-Type "text/html; charset=utf-8"
respond `<!DOCTYPE html><html><head><meta charset="utf-8"><title>RustDesk</title>
<style>body{font-family:system-ui;background:#0c0e12;color:#e8ecf4;max-width:40rem;margin:3rem auto;padding:0 1rem;line-height:1.5}
code{background:#1a1f2a;padding:.15rem .4rem;border-radius:4px;color:#6ea8fe}</style></head>
<body>
<h1>RustDesk server</h1>
<p><strong>ID / rendezvous server:</strong> <code>rustdesk.devopshomelab.com</code></p>
<p><strong>Relay server:</strong> <code>rustdesk.devopshomelab.com</code> (port <code>21117</code>)</p>
<p>In the RustDesk client: Network ID server = hostname above. Paste the server public key from the host admin.</p>
<p>Open ports on the router/firewall: <code>2111521119</code> TCP and <code>21116</code> UDP.</p>
</body></html>` 200
}
www.devopshomelab.com {
redir https://devopshomelab.com{uri} permanent
}
devopshomelab.com {
encode gzip
root * /srv
file_server
try_files {path} /index.html
}
# --- HTTP :80 (ACME + LAN IP landing) ----------------------------------------
:80 {
@lan {
host 192.168.8.123 localhost 127.0.0.1
}
handle @lan {
root * /srv
encode gzip
file_server
try_files {path} /index.html
}
@acme_hosts {
host devopshomelab.com www.devopshomelab.com forgejo.devopshomelab.com jellyfin.devopshomelab.com rustdesk.devopshomelab.com
}
handle @acme_hosts {
redir https://{host}{uri} permanent
}
# Default: still serve the map (LAN hostname / other access)
handle {
root * /srv
encode gzip
file_server
try_files {path} /index.html
}
}