3 # For using Caddy with its API.
5 # This unit is "durable" in that it will automatically resume
6 # the last active configuration if the service is restarted.
8 # See https://caddyserver.com/docs/install for instructions.
11 Description=Caddy API Server
12 Documentation=https://caddyserver.com/docs/
13 After=network-online.target
14 Wants=network-online.target systemd-networkd-wait-online.service
15 StartLimitIntervalSec=14400
22 Environment=XDG_DATA_HOME=/var/lib
23 Environment=XDG_CONFIG_HOME=/var/lib
24 ExecStart=/usr/bin/caddy run --environ --resume
26 # Do not allow the process to be restarted in a tight loop. If the
27 # process fails to start, something critical needs to be fixed.
30 # Use graceful shutdown with a reasonable timeout
37 AmbientCapabilities=CAP_NET_BIND_SERVICE
38 CapabilityBoundingSet=CAP_NET_BIND_SERVICE
42 MemoryDenyWriteExecute=true
48 ProtectControlGroups=true
51 ProtectKernelLogs=true
52 ProtectKernelModules=true
53 ProtectKernelTunables=true
57 ReadWritePaths=/var/lib/caddy /var/log/caddy /run/caddy
58 RestrictNamespaces=true
63 WantedBy=multi-user.target