1. The problem I’m having:
I had a working Caddy instance with open 80/443 ports with cloudflare where all domains were internal resolving fine. However I decided to close the ports down and instead use xcaddy with cf plugin.
I managed to work through multiple issues and troubleshooting to get services installed & running fine, yet I cannot resolve my internal domains.
On Cloudflare I simply have A record with * pointing to my local lan IP where my caddy install is with DNS only reserved IP.
2. Error messages and/or full log output:
root@Caddy:~#
root@Caddy:~# status caddy
-bash: status: command not found
root@Caddy:~# service caddy status
* caddy.service - Caddy
Loaded: loaded (/lib/systemd/system/caddy.service; enabled; preset: enabled)
Active: active (running) since Sat 2024-09-14 11:07:55 UTC; 3min 21s ago
Docs: https://caddyserver.com/docs/
Main PID: 324 (caddy)
Tasks: 7 (limit: 9190)
Memory: 10.9M
CPU: 95ms
CGroup: /system.slice/caddy.service
`-324 /usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7528937,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7529747,"msg":"failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 7168 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Si>
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7530856,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7531323,"logger":"http.log","msg":"server running","name":"srv1","protocols":["h1","h2","h3"]}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7531385,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["photos.nznux.com","titan.nznux.com","paperless.nznux.com","jellyfin.nznux.com","pr>
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7564034,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/var/lib/caddy/.local/share/caddy","instance":"1913ad1d-6056->
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7564645,"logger":"tls","msg":"finished cleaning storage units"}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7565536,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7567377,"msg":"serving initial configuration"}
Sep 14 11:07:55 Caddy systemd[1]: Started caddy.service - Caddy.
root@Caddy:~# curl -v https://jellyfin.nznux.com
* Trying 192.168.1.11:443...
* Connected to jellyfin.nznux.com (192.168.1.11) port 443 (#0)
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN: server accepted h2
* Server certificate:
* subject: CN=jellyfin.nznux.com
* start date: Sep 14 10:07:24 2024 GMT
* expire date: Dec 13 10:07:23 2024 GMT
* subjectAltName: host "jellyfin.nznux.com" matched cert's "jellyfin.nznux.com"
* issuer: C=US; O=Let's Encrypt; CN=E5
* SSL certificate verify ok.
* using HTTP/2
* h2h3 [:method: GET]
* h2h3 [:path: /]
* h2h3 [:scheme: https]
* h2h3 [:authority: jellyfin.nznux.com]
* h2h3 [user-agent: curl/7.88.1]
* h2h3 [accept: */*]
* Using Stream ID: 1 (easy handle 0x6398a767ece0)
> GET / HTTP/2
> Host: jellyfin.nznux.com
> user-agent: curl/7.88.1
> accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/2 302
< alt-svc: h3=":443"; ma=2592000
< date: Sat, 14 Sep 2024 11:11:51 GMT
< location: web/
< server: Caddy
< server: Kestrel
< content-length: 0
<
* Connection #0 to host jellyfin.nznux.com left intact
Here are the logs from journalctl -xeu caddy.service
root@Caddy:/etc/caddy# journalctl -xeu caddy.service
-- A stop job for unit caddy.service has finished.
--
-- The job identifier is 118 and the job result is done.
Sep 14 11:07:55 Caddy systemd[1]: Starting caddy.service - Caddy...
-- Subject: A start job for unit caddy.service has begun execution
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit caddy.service has begun execution.
--
-- The job identifier is 119.
Sep 14 11:07:55 Caddy caddy[324]: caddy.HomeDir=/var/lib/caddy
Sep 14 11:07:55 Caddy caddy[324]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
Sep 14 11:07:55 Caddy caddy[324]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
Sep 14 11:07:55 Caddy caddy[324]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
Sep 14 11:07:55 Caddy caddy[324]: caddy.Version=v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=
Sep 14 11:07:55 Caddy caddy[324]: runtime.GOOS=linux
Sep 14 11:07:55 Caddy caddy[324]: runtime.GOARCH=amd64
Sep 14 11:07:55 Caddy caddy[324]: runtime.Compiler=gc
Sep 14 11:07:55 Caddy caddy[324]: runtime.NumCPU=2
Sep 14 11:07:55 Caddy caddy[324]: runtime.GOMAXPROCS=2
Sep 14 11:07:55 Caddy caddy[324]: runtime.Version=go1.23.1
Sep 14 11:07:55 Caddy caddy[324]: os.Getwd=/
Sep 14 11:07:55 Caddy caddy[324]: LANG=C
Sep 14 11:07:55 Caddy caddy[324]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Sep 14 11:07:55 Caddy caddy[324]: NOTIFY_SOCKET=/run/systemd/notify
Sep 14 11:07:55 Caddy caddy[324]: HOME=/var/lib/caddy
Sep 14 11:07:55 Caddy caddy[324]: LOGNAME=caddy
Sep 14 11:07:55 Caddy caddy[324]: USER=caddy
Sep 14 11:07:55 Caddy caddy[324]: INVOCATION_ID=1f79bc3f59524c4694c3bb71199f7635
Sep 14 11:07:55 Caddy caddy[324]: JOURNAL_STREAM=8:43209984
Sep 14 11:07:55 Caddy caddy[324]: SYSTEMD_EXEC_PID=324
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7455206,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7491717,"msg":"adapted config to JSON","adapter":"caddyfile"}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"warn","ts":1726312075.7492056,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":11}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7514281,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7519143,"logger":"http.auto_https","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","htt>
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7519479,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"warn","ts":1726312075.751962,"logger":"http.auto_https","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv1","http_port":8>
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7522135,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000376a80"}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7528937,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7529747,"msg":"failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 7168 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Si>
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7530856,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7531323,"logger":"http.log","msg":"server running","name":"srv1","protocols":["h1","h2","h3"]}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7531385,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["photos.nznux.com","titan.nznux.com","paperless.nznux.com","jellyfin.nznux.com","pr>
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7564034,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/var/lib/caddy/.local/share/caddy","instance":"1913ad1d-6056->
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7564645,"logger":"tls","msg":"finished cleaning storage units"}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7565536,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Sep 14 11:07:55 Caddy caddy[324]: {"level":"info","ts":1726312075.7567377,"msg":"serving initial configuration"}
Sep 14 11:07:55 Caddy systemd[1]: Started caddy.service - Caddy.
-- Subject: A start job for unit caddy.service has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit caddy.service has finished successfully.
--
-- The job identifier is 119.
3. Caddy version:
caddy version
v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=
4. How I installed and ran Caddy:
a. System environment:
Running Debian 12 on Proxmox and installed Caddy following guide here: Install — Caddy Documentation
Installed xcaddy following guide here: GitHub - caddy-dns/cloudflare: Caddy module: dns.providers.cloudflare
& this video https://youtu.be/9zm8d0jXY9o?si=rcBKCHDLBhImXVKI
b. Command:
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.
c. Service/unit/compose file:
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.
d. My complete Caddy config:
{
acme_dns cloudflare myCFToken
}
:80 {
# Set this path to your site's directory.
root * /usr/share/caddy
# Enable the static file server.
file_server
# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080
# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
}
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile
#jellyfin.nznux.com {
# reverse_proxy 192.168.1.2:8096
# tls {
# dns cloudflare {env.CLOUDFLARE_API_TOKEN}
# }
#}
paperless.nznux.com {
reverse_proxy 192.168.1.13:8000
}
jellyfin.nznux.com {
reverse_proxy 192.168.1.2:8096
}
pihole.nznux.com {
encode zstd gzip
redir / /admin{uri}
reverse_proxy 192.168.1.5:80
# reverse_proxy 192.168.1.5:81
}
photos.nznux.com {
reverse_proxy 192.168.1.2:5001
}
titan.nznux.com {
reverse_proxy 192.168.1.2:5001 {
transport http {
tls_insecure_skip_verify
}
}
}
proxmox.nznux.com {
reverse_proxy 192.168.1.12:8006 {
transport http {
tls_insecure_skip_verify
}
}
}