I am trying to start caddy with my configuration, but I get a configuration error which I cannot seem to figure out. The configuration is from the last example on this page: tls (Caddyfile directive) ā Caddy Documentation
2020/05/07 20:56:39.250 INFO using provided configuration {"config_file": "Caddyfile", "config_adapter": ""}
run: adapting config using caddyfile: Caddyfile:8: unrecognized directive: dns
You have placed the tls directive outside of a site block.
Therefore, Caddy is interpreting tls as the site label (the name of the site you want to serve), and is trying to interpret dns as a directive for configuring that site. As the error notes, dns is not a directive, so this causes a problem.
The examples in the tls documentation are intended to go inside a site block.