Issue with the errors directive

If I enable the errors directive as such:

errors {
    log stdout

I get the following error:

Activating privacy features…YYYY/MM/DD HH:MM:SS [INFO][errors] acme: Obtaining bundled SAN certificate
YYYY/MM/DD HH:MM:SS [errors] failed to get certificate: acme: Error 400 - urn:acme:error:malformed - DNS name does not have enough labels

If I try to add a custom 404 page as described in the docs I get this:

YYYY/MM/DD HH:MM:SS /etc/caddy/Caddyfile:17 - Parse error: Unknown directive ‘404’

Not sure what’s wrong here.

What’s your entire Caddyfile?

errors {
    log stdout
    404 404.html
} {
    tls redacted@email.tld
    proxy / {

* {
    tls off

It’s the first block that’s giving me errors, running Caddy 0.9.1 on Ubuntu Server 16.04 x64.

It’s running as a service, entirely mirrored the guidelines found here:


The Caddyfile always starts with the address of the site to serve.

—First line of Caddyfile syntax documentation

Hope that helps!

Edit: scratch that, moved the errors block to the bottom of the Caddyfile, still getting the same errors.

Make sure that your Caddyfile is structured properly. Caddy is expecting a site name where you have a directive. :wink:


I’m just so used to nginx where you can have global settings for multiple servers.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.