Skip to content

Caddy as a service examples

devil1591 edited this page Sep 19, 2016 · 11 revisions

systemd

Please see dist/init/linux-systemd for the most recent complete systemd unit file.

You will need systemd version ≥229! For example: Ubuntu 16.04, Coreos 1029.0.0, Debian unstable sid (not 8.0), Fedora rawhide (not 23) and later come with that version of systemd.

FreeBSD rc.d

Example for an init script on FreeBSD: https://gist.github.com/dprandzioch/f3a0bc4ebde3efd5c2a4

Windows

You can use nssm.cc in order to automaticaly launch, and restart if crashed Caddy.

  1. First download both NSSM and Caddy then extract them to c:\myserver\
  2. Then install Caddy as a service by entering the following commands in your Terminal:

c:\myserver\nssm.exe install Caddy c:\myserver\caddy.exe
c:\myserver\nssm.exe set Caddy AppDirectory C:\myserver\

Clone this wiki locally