{"config_file": "caddyfile", "config_adapter": ""} run: loading initial config: decoding request body: invalid character 'e' looking for beginning of value
Caddy expects files using Caddyfile syntax to start with Caddyfile, with the uppercase C to assume that it is a Caddyfile config, otherwise it assumes it’s JSON.
Your options are to either rename your file from caddyfile to Caddyfile, or also specify the --adapter caddyfile CLI argument:
Edit: Derp, I read too fast, I read your Caddy v1 config and skimmed past your Caddy v2 config
Ignore the following, but leaving it in because
Oh also, you’ll have a few syntax issues with your Caddyfile due to differences between v1 and v2.
Caddy will parse the first argument for root as being a path matcher because it starts with /. Instead, you’ll need to put a * as the first argument to root to avoid that issue.
root * /home/epi/website/public
Also, in general, path matching in Caddy v2 is exact-match, so the matcher / for the header directive will only match requests to / and not /foo. You can simply omit the / for Caddy to assume *, meaning “all requests”.
And finally, the log directive does not work the same way as in Caddy v1. Please refer to the docs for this one.
Scratch most of the above comment… but… there is a problem with your header directive. I’ll want to wrap the header value in quotes so that Caddy parses the value as a single token.
2020/07/16 05:28:14.565 INFO using provided configuration {"config_file": "Caddyfile", "config_adapter": ""}
run: loading initial config: loading new config: starting caddy administration endpoint: listen tcp: lookup localhost on 8.8.8.8:53: no such host
(For some reason, your system is not resolving localhost to 127.0.0.1 and is redirecting queries for localhost to 8.8.8.8, which is Google’s public resolver! You will need to address this abnormal behaviour in order for Caddy to run properly.)
This means that LetsEncrypt tried to challenge Caddy via ALPN (essentially some additional negotiation that happens while TLS is being established) but couldn’t.
This pretty much only ever happens if there’s something in front of Caddy terminating TLS - like an additional proxy layer. If LetsEncrypt is talking directly to Caddy, TLS-ALPN challenges generally Just Work™️.