3 # For using Caddy with a config file.
5 # Make sure the ExecStart and ExecReload commands are correct
6 # for your installation.
8 # See https://caddyserver.com/docs/install for instructions.
10 # WARNING: This service does not use the --resume flag, so if you
11 # use the API to make changes, they will be overwritten by the
12 # Caddyfile next time the service is restarted. If you intend to
13 # use Caddy's API to configure it, add the --resume flag to the
14 # `caddy run` command or use the caddy-api.service file instead.
17 Description=Caddy web server
18 Documentation=https://caddyserver.com/docs/
19 After=network-online.target
20 Wants=network-online.target systemd-networkd-wait-online.service
21 StartLimitIntervalSec=14400
28 Environment=XDG_DATA_HOME=/var/lib
29 Environment=XDG_CONFIG_HOME=/etc
30 ExecStartPre=/usr/bin/caddy validate --config /etc/caddy/Caddyfile
31 ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
32 ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force
33 ExecStopPost=/usr/bin/rm -f /run/caddy/admin.socket
35 # Do not allow the process to be restarted in a tight loop. If the
36 # process fails to start, something critical needs to be fixed.
39 # Use graceful shutdown with a reasonable timeout
46 AmbientCapabilities=CAP_NET_BIND_SERVICE
47 CapabilityBoundingSet=CAP_NET_BIND_SERVICE
51 MemoryDenyWriteExecute=true
57 ProtectControlGroups=true
60 ProtectKernelLogs=true
61 ProtectKernelModules=true
62 ProtectKernelTunables=true
66 ReadWritePaths=/var/lib/caddy /var/log/caddy /run/caddy
67 RestrictNamespaces=true
72 WantedBy=multi-user.target