Cannot restart caddy after adding new entry to Caddyfile

1. The problem I’m having:

I added a new entry to my Caddyfile, and now I cannot start or restart the caddy service

2. Error messages and/or full log output:

Not sure where to find this at

3. Caddy version:

v2.10.2

4. How I installed and ran Caddy:

Installed as an Ubuntu package

a. System environment:

Ubuntu server 24.04 VM running on a proxmox host

b. Command:

systemctl start caddy.service

c. Service/unit/compose file:

root@caddy:/etc/caddy/sites-enabled# systemctl status caddy.service× caddy.service - CaddyLoaded: loaded (/usr/lib/systemd/system/caddy.service; enabled; preset: enabled)Active: failed (Result: exit-code) since Fri 2025-12-05 14:59:53 UTC; 2s agoDuration: 1d 21h 33min 20.847sDocs: Process: 3117 ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)Main PID: 3117 (code=exited, status=1/FAILURE)CPU: 214msDec 05 14:59:53 caddy caddy[3117]: JOURNAL_STREAM=8:35753Dec 05 14:59:53 caddy caddy[3117]: SYSTEMD_EXEC_PID=3117Dec 05 14:59:53 caddy caddy[3117]: MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/system.slice/caddy.service/memory.pressureDec 05 14:59:53 caddy caddy[3117]: MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=Dec 05 14:59:53 caddy caddy[3117]: {“level”:“info”,“ts”:1764946793.7482376,“msg”:“using config from file”,“file”:“/etc/caddy/Caddyfile”}Dec 05 14:59:53 caddy caddy[3117]: {“level”:“info”,“ts”:1764946793.754047,“msg”:“maxprocs: No GOMAXPROCS change to reset”}Dec 05 14:59:53 caddy caddy[3117]: Error: adapting config using caddyfile: /etc/caddy/sites-enabled/vault:1: unrecognized directive: https://vault.kylejrothfus.netDec 05 14:59:53 caddy systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILUREDec 05 14:59:53 caddy systemd[1]: caddy.service: Failed with result ‘exit-code’.Dec 05 14:59:53 caddy systemd[1]: Failed to start caddy.service - Caddy.

d. My complete Caddy config:

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.
{
        email digipen79@gmail.com
        acme_ca https://acme-staging-v02.api.letsencrypt.org/directory

        servers {
                protocols h1 h2 h3
        }
}

https://kylejrothfus.net {
        # Set this path to your site's directory.
        root * /var/www/kylejrothfus.net

        # Enable the static file server.
        file_server

        handle_errors {
                respond "{err.status_code} {err.status_text}"
        }
        # 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
}

import sites-enabled/*

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

So this was working normally, until I added a new file for the Caddyfile to import, but it’s not the one that is giving the error.

https://vault.kylejrothfus.net {
        handle {
                reverse_proxy https://192.168.10.200 {
                        transport http {
                                tls_insecure_skip_verify
                        }
                }
        }
}

Basically all 10 files look like this, with very basic configs for each URL and reverse proxy combo.

You haven’t shared the configuration that you’re importing here. That’s where your error is happening, judging by the error log you’ve shared.

One of your files must have a missing closing } which causes the next file in sequence to remain “open” so it parses https://vault.kylejrothfus.net as being a directive inside the previous site block.

1 Like

I wasn’t allowed to reply until now, but this was the answer, the newest file I created for this had an extra { in it.

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