caddy.service 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. [Unit]
  2. Description=Caddy HTTP/2 web server
  3. Documentation=https://caddyserver.com/docs
  4. After=network-online.target
  5. Wants=network-online.target systemd-networkd-wait-online.service
  6. [Service]
  7. ;Restart=on-failure
  8. StartLimitInterval=86400
  9. StartLimitBurst=5
  10. ; User and group the process will run as.
  11. User=www-data
  12. Group=www-data
  13. ; Letsencrypt-issued certificates will be written to this directory.
  14. Environment=CADDYPATH=/etc/ssl/caddy
  15. ; Always set "-root" to something safe in case it gets forgotten in the Caddyfile.
  16. ExecStart=/usr/local/bin/caddy -log stdout -agree=true -conf=/etc/caddy/Caddyfile -root=/var/tmp
  17. ExecReload=/bin/kill -USR1 $MAINPID
  18. ; Limit the number of file descriptors; see `man systemd.exec` for more limit settings.
  19. LimitNOFILE=1048576
  20. ; Unmodified caddy is not expected to use more than that.
  21. LimitNPROC=64
  22. ; Use private /tmp and /var/tmp, which are discarded after caddy stops.
  23. PrivateTmp=true
  24. ; Use a minimal /dev
  25. PrivateDevices=true
  26. ; Hide /home, /root, and /run/user. Nobody will steal your SSH-keys.
  27. ;ProtectHome=true
  28. ; Make /usr, /boot, /etc and possibly some more folders read-only.
  29. ;ProtectSystem=full
  30. ; … except /etc/ssl/caddy, because we want Letsencrypt-certificates there.
  31. ; This merely retains r/w access rights, it does not add any new. Must still be writable on the host!
  32. ReadWriteDirectories=/etc/ssl/caddy
  33. ; The following additional security directives only work with systemd v229 or later.
  34. ; They further retrict privileges that can be gained by caddy. Uncomment if you like.
  35. ; Note that you may have to add capabilities required by any plugins in use.
  36. ;CapabilityBoundingSet=CAP_NET_BIND_SERVICE
  37. ;AmbientCapabilities=CAP_NET_BIND_SERVICE
  38. ;NoNewPrivileges=true
  39. [Install]
  40. WantedBy=multi-user.target