1. The problem I’m having:
Hello.
After restarting my VPS many times yesterday something broke: Caddy is not using the Caddyfile. By sheer chance I have found the solution here: Caddy gives errors on the most basic Caddyfile? - #4 by range-et
My question is, where can I specify for Caddy to use my Caddyfile? I have mine inside /home/username/ , it used to work in the past. Now I am lost. Caddy as a service also no longer starts when rebooting according to sudo systemctl caddy status. Not sure why. But when I start the service, or reload it with systemctl, it still does not load my Caddyfile, i have to specifically start with sudo caddy start --config Caddyfile
I doubt it’s the formatting of my Caddyfile, I did run ‘caddy fmt --overwrite’ on it like 20 times.
2. Error messages and/or full log output:
This is the error when I am not using my Caddyfile:
{“level”:“warn”,“ts”:1709384989.7451005,“msg”:"Caddyfile input is not formatted; run ‘caddy fmt --overwrite’ to fix inconsi…
{“level”:“warn”,“ts”:1709384989.7707202,“logger”:“http.auto_https”,“msg”:"server is listening only on the HTTP port, so no a…
3. Caddy version:
v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=
(installed on ubuntu according to docs)
4. How I installed and ran Caddy:
I installed (and re-installed just now) it according to docs on Ubuntu. Install — Caddy Documentation
b. Command:
I type no commands, in the past Caddy would start by itself.
d. My complete Caddy config:
# Set the email address that should be used to contact you if there is a problem with
# your TLS certificates.
# Run `caddy fmt --overwrite` to format this file
{
email myemailaddress@example.com
}
api.example.com {
respond /debug/* "Not Permitted" 403
reverse_proxy 127.0.0.1:4000
}