This page describes how to manually install Caddy as a service.
caddybinary that you downloaded or built from source
systemctl --version232 or newer
Move the caddy binary into your
$PATH, for example:
sudo mv caddy /usr/bin/
Test that it worked:
Create a group named
sudo groupadd --system caddy
Create a user named
caddy, with a writeable home folder:
sudo useradd --system \ --gid caddy \ --create-home \ --home-dir /var/lib/caddy \ --shell /usr/sbin/nologin \ --comment "Caddy web server" \ caddy
If using a config file, be sure it is readable by the
caddy user you just created.
Next, choose a systemd service file based on your use case:
caddy.serviceif you configure Caddy with a file.
caddy-api.serviceif you configure Caddy solely through its API.
They are very similar but have minor differences in the ExecStart and ExecReload commands to accommodate your workflow. Customize the file accordingly.
ExecReload directives. Make sure the binary's location and command line arguments are correct for your installation! For example: if using a config file, change your
--config path if it is different from our example.
The usual place to save the service file is:
After saving your service file, you can start the service for the first time with the usual systemctl dance:
sudo systemctl daemon-reload sudo systemctl enable caddy sudo systemctl start caddy
Verify that it is running:
systemctl status caddy
When running with our official service file, Caddy's output will be redirected to
journalctl -u caddy
If using a config file, you can gracefully apply any changes:
sudo systemctl reload caddy
You can stop the service with:
sudo systemctl stop caddy
Now that Caddy is installed, see our Getting Started tutorial to learn how to use it!