1. Caddy version (caddy version
):
v2.1.1
2. How I run Caddy:
Caddy is started from systemd. Installed locally on physical machine.
It is only used for reverse_proxy.
a. System environment:
Linux Mint 20
systemd - systemd 245 (245.4-4ubuntu3.2)
jimmy@mint:~$ caddy environ
caddy.HomeDir=/home/jimmy
caddy.AppDataDir=/home/jimmy/.local/share/caddy
caddy.AppConfigDir=/home/jimmy/.config/caddy
caddy.ConfigAutosavePath=/home/jimmy/.config/caddy/autosave.json
runtime.GOOS=linux
runtime.GOARCH=amd64
runtime.Compiler=gc
runtime.NumCPU=16
runtime.GOMAXPROCS=16
runtime.Version=go1.14.4
os.Getwd=/home/jimmy
b. Command:
sudo nano systemctl start caddy
c. Service/unit/compose file:
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target
[Service]
User=jimmy
Group=jimmy
ExecStart=/usr/bin/caddy run --environ --config /home/jimmy/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /home/jimmy/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
d. My complete Caddyfile or JSON config:
tautulli.mysrvr.me {
gzip
proxy / localhost:8181 {
transparent
}
}
#sonarr
sonarr.mysrvr.me {
gzip
proxy / localhost:8989 {
transparent
}
}
#radarr
radarr.mysrvr.me {
gzip
proxy / localhost:7878 {
transparent
}
}
#ombi
ombi.jsuttinger.com {
gzip
proxy / localhost:5000 {
transparent
}
}
#portainer
portainer.mysrvr.me {
gzip
proxy / localhost:9000 {
transparent
}
}
#jellyfin
jellyfin.mysrvr.me {
gzip
proxy / localhost:8096 {
transparent
websocket
}
}
#nextcloud
nextcloud.jsuttinger.com {
gzip
proxy / localhost:8823 {
transparent
websocket
}
}
#airsonic
audio.mysrvr.me {
gzip
proxy / localhost:4040 {
transparent
}
}
#bookstack
wiki.mysrvr.me {
gzip
proxy / localhost:6875 {
transparent
}
}
#app
#app.mysrvr.me {
# encode gzip
# reverse_proxy localhost:port
#}
3. The problem I’m having:
I accidentally got fat fingered and moved ~/caddy/Caddfile
to a new location. Ooops! I noticed later and moved it back to the original location, ~/caddy/
Since, I am unable to start it with systemd.
4. Error messages and/or full log output:
â—Ź caddy.service - Caddy
Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2020-07-31 14:32:26 EDT; 2s ago
Docs: https://caddyserver.com/docs/
Process: 71351 ExecStart=/usr/bin/caddy run --environ --config /home/jimmy/caddy/Caddyfile (code=exited, status=1/FAILURE)
Main PID: 71351 (code=exited, status=1/FAILURE)
Jul 31 14:32:26 mint caddy[71351]: JOURNAL_STREAM=9:647671
Jul 31 14:32:26 mint caddy[71351]: {"level":"info","ts":1596220346.9619558,"msg":"using provided configuration","config_file":"/home/jimmy/caddy/Caddyfile","config_adapter":""}
Jul 31 14:32:26 mint caddy[71351]: {"level":"info","ts":1596220346.9641256,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["127.0.0.1:2019","localhost:2019","[::1]:2019"]}
Jul 31 14:32:26 mint caddy[71351]: 2020/07/31 14:32:26 [INFO][cache:0xc000804b40] Started certificate maintenance routine
Jul 31 14:32:26 mint caddy[71351]: {"level":"info","ts":1596220346.9645755,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
Jul 31 14:32:26 mint caddy[71351]: {"level":"info","ts":1596220346.9645998,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Jul 31 14:32:26 mint caddy[71351]: {"level":"info","ts":1596220346.9699855,"logger":"tls","msg":"cleaned up storage units"}
Jul 31 14:32:26 mint caddy[71351]: run: loading initial config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: address already in use
Jul 31 14:32:26 mint systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Jul 31 14:32:26 mint systemd[1]: caddy.service: Failed with result 'exit-code'.
5. What I already tried:
I have tried to adjust the permissions on the Caddyfile
, tried 755. It’s currently back at 644.
I have tried to restart systemd, restart server, restart caddy, caddy reload
I have tried changing the ExecStart
and ExecReload
paths to use ~/ or env variable $USERDIR
I have tried changing the user and group in the caddy.service
systemd file
I have tried deleting and re-creating the caddy.service
systemd file.
None of these have provided different results.
6. Links to relevant resources:
source of systemd: dist/caddy.service at master · caddyserver/dist · GitHub