- Get yr site files ready
mkdir C:\sites\skaia-library
Drop yr index.html in there.
- Install Caddy
Easiest is scoop install caddy with https://scoop.sh/, or grab the binary directly from caddyserver.com/download. No need for the caddy_windows_amd64.exe build with plugins.
- Caddyfile
Since Cloudflare Tunnel will handle the public-facing TLS, Caddy only needs to serve locally, so no need for its automatic HTTPS:
:8080 {
root * C:\sites\skaia-library
file_server
}
Run it from that directory: caddy run --config Caddyfile
- Install cloudflared
winget install --id Cloudflare.cloudflared -e (or grab the .exe from the cloudflared GitHub releases page).
- Authenticate
Run cloudflared tunnel login in the cmd.
This will pop up a browser window, log in and pick the zone (domain) you want to authorize.
- Create the tunnel
cloudflared tunnel create skaia-tunnel
This will generate a tunnel UUID and drops a credentials JSON in %USERPROFILE%\.cloudflared\.
- Route a hostname to it
cloudflared tunnel route dns mysite-tunnel sub.skaia-library.xyz
This will create the CNAME in Cloudflare DNS pointing at <UUID>.cfargotunnel.com.
- Create the config file at
%USERPROFILE%\.cloudflared\config.yml:
yamltunnel: skaia-tunnel
credentials-file: C:\Users\YOURNAME\.cloudflared\<UUID>.json
ingress:
- hostname: sub.skaia-library.xyz
service: http://localhost:8080
- service: http_status:404
- Run it!
cloudflared tunnel run skaia-tunnel
Site should now be live at sub.skaia-library.xyz, proxied through Cloudflare.
- Make it persistent
cloudflared service install registers cloudflared as a Windows service using that config.yml which means it'll survive reboots.
Caddy doesn't have a built-in Windows service installer, it will need to run with Task Scheduler at logon/startup, or use NSSM (nssm install caddy) to wrap it as a proper service. https://nssm.cc/