Skip to content

Caddy as a service examples

Fábio Ferreira edited this page Sep 24, 2017 · 16 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 automatically 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\
c:\myserver\nssm.exe set Caddy AppParameters -agree=true -log=C:\myserver\Caddylog.log Or whatever parameters you need to pass

Caddy-service

You can download Caddy with caddy-service plugin already embedded on it.

  1. Download Caddy with caddy-service (hook.service option).
  2. Install and start Caddy as a service.

caddy -service install [caddyOptions]
caddy -service start

You can’t perform that action at this time.