Install

This page describes how to manually install Caddy as a service.

If you downloaded Caddy using a package manager such as apt or dnf, then Caddy is already installed, and you should jump to Getting Started.

Linux service

Requirements:

Move the caddy binary into your $PATH, for example:

  1. sudo mv caddy /usr/bin/

Test that it worked:

  1. caddy version

Create a group named caddy:

  1. sudo groupadd --system caddy

Create a user named caddy, with a writeable home folder:

  1. sudo useradd --system \
  2. --gid caddy \
  3. --create-home \
  4. --home-dir /var/lib/caddy \
  5. --shell /usr/sbin/nologin \
  6. --comment "Caddy web server" \
  7. 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:

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: /etc/systemd/system/caddy.service

After saving your service file, you can start the service for the first time with the usual systemctl dance:

  1. sudo systemctl daemon-reload
  2. sudo systemctl enable caddy
  3. sudo systemctl start caddy

Verify that it is running:

  1. systemctl status caddy

When running with our official service file, Caddy’s output will be redirected to journalctl:

  1. journalctl -u caddy

If using a config file, you can gracefully apply any changes:

  1. sudo systemctl reload caddy

You can stop the service with:

  1. 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.

Now that Caddy is installed, see our Getting Started tutorial to learn how to use it!