Caddy Server for Emby configuration file

1. The problem I’m having:

I’ve been running Caddy for over a year on a Rasberry Pi. The SD card crashed so I created a new one from a backup. Besides Caddy I’m also running PiVPN and PiHole and they both work. I don’t have a web server; I’m using it for access to Emby on another device. But it seems my Caddyfile has gone stale. Caddy Server won’t start and I can’t validate the Caddyfile.

2. Error messages and/or full log output:

caddy validate --config /etc/caddy/Caddyfile
2023/10/06 20:03:46.942 INFO    using provided configuration    {"config_file": "/etc/caddy/Caddyfile", "config_adapter": ""}
Error: adapting config using caddyfile: parsing caddyfile tokens for 'log': /etc/caddy/Caddyfile:13 - Error during parsing: Wrong argument count or unexpected line ending after 'true', import chain: ['']

Also

sudo systemctl status caddy
● caddy.service - caddy
   Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2023-10-06 17:06:24 EDT; 4s ago
  Process: 26598 ExecStart=/home/pi/.local/bin/caddy run --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
 Main PID: 26598 (code=exited, status=1/FAILURE)

Oct 06 17:06:24 raspberrypi systemd[1]: caddy.service: Service RestartSec=100ms expired, scheduling restart.
Oct 06 17:06:24 raspberrypi systemd[1]: caddy.service: Scheduled restart job, restart counter is at 3.
Oct 06 17:06:24 raspberrypi systemd[1]: Stopped caddy.
Oct 06 17:06:24 raspberrypi systemd[1]: caddy.service: Start request repeated too quickly.
Oct 06 17:06:24 raspberrypi systemd[1]: caddy.service: Failed with result 'exit-code'.
Oct 06 17:06:24 raspberrypi systemd[1]: Failed to start caddy.

3. Caddy version:

v2.7.4 h1:J8nisjdOxnYHXlorUKXY75Gr6iBfudfoGhrJ8t7/flI=

4. How I installed and ran Caddy:

curl -sS https://webinstall.dev/caddy | bash

later

caddy upgrade

To start

sudo systemctl start caddy

a. System environment:

Raspberry Pi 4b
Raspbian
5.10.103-v7+

b. Command:

curl ckran.noip.me 

c. Service/unit/compose file:

Running native.

d. My complete Caddy config:

ckran.noip.me {
        encode gzip
        log {
                output file /var/log/caddy/emby_access.log {
                        roll true             # Rotate logs, enabled by default
                        roll_size_mb 5        # Set max size 5 MB
                        roll_gzip true        # Compress files
                        roll_local_time true  # use localhost time 
                        roll_keep 2           # Keep at most 2 log files
                        roll_keep_days 7      # Keep log files for 7 days
                }
        }
        reverse_proxy 192.168.1.37:8096
}

192.168.1.8 {
        reverse_proxy 192.168.1.8 /*  :480 */
}

http://pi.hole {
        reverse_proxy 192.168.1.8  /* :480 */
}

5. Links to relevant resources:

See the docs, that doesn’t exist as an option:

Thanks for your review. I had originally followed a tutorial for emby and caddy. I removed that line; I still get the same error. I see that roll_gzip isn’t on that doc page either. I removed it; same error. I still have roll_local_time which is on that page. Although without an argument. How is that supposed to work? Thanks again.,

If there’s no argument then it’s simply a flag and specifying it enables that option.

Got it. Thanks. I removed true and I can again validate the Caddyfile without error.

But the caddy server still fails to start.

Okay, with what error? Can’t help without specifics.

Same error as in original report in #2 above.

I don’t understand. That’s not your full logs.

Please read Keep Caddy Running — Caddy Documentation to understand how to get your full logs.

Thanks for your help. Found the error in the full log. Port 80 was in use.

As for the Caddyfile errors those parameters used to not cause errors. After I rebuilt my PI with the restored backup I updated everything including Caddy. I’m guessing that the parameters were deprecated and while they once were allowed the code was subsequently tightened.

Those were never valid config options. I don’t know where they came from. Certainly not from our docs.

Don’t copy-paste random config you find on the internet without understanding what it does. Check the docs to confirm.

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