Install
If you downloaded Caddy using a package manager such as or dnf
, then Caddy is already installed, and you should jump to .
Requirements:
caddy
binary that you downloaded orsystemctl --version
232 or newersudo
privileges
Move the caddy binary into your $PATH
, for example:
Test that it worked:
Create a group named 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:
- if you configure Caddy with a file.
caddy-api.service
if 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.
Double-check the ExecStart
and 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:
sudo systemctl daemon-reload
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
:
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
Do not stop the service to change Caddy’s configuration. Stopping the server will incur downtime. Use the reload command instead.