caddy-website/src/docs/markdown/install.md
Matthew Holt 4827cff659
docs: Update for v2.3; refactor install information
We now have only 1 download page, yay. Install docs are organized better. Less confusing.

Automatic HTTPS docs improved, and menu added.

Other minor updates to bring up to speed for v2.3.
2020-12-30 07:37:15 -07:00

5.8 KiB

title
Install

Install

This page describes various methods for installing Caddy on your system.

Official:

Community-maintained:

Static binaries

Simply downloading a Caddy binary does not install it as a service, but can be useful in dev or when upgrading an existing installation.

Debian, Ubuntu, Raspbian

echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \
    | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
sudo apt update
sudo apt install caddy

Installing this package automatically starts and runs Caddy for you as a systemd service named caddy using our official caddy.service unit file.

Fedora, RedHat, CentOS

Fedora or RHEL/CentOS 8:

dnf install 'dnf-command(copr)'
dnf copr enable @caddy/caddy
dnf install caddy

RHEL/CentOS 7:

yum install yum-plugin-copr
yum copr enable @caddy/caddy
yum install caddy

View the Caddy COPR

Docker

docker pull caddy

View on Docker Hub

DigitalOcean

Deploy a Caddy droplet on DigitalOcean

Linux service

Manually install Caddy as a service on Linux with these instructions.

Requirements:

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

sudo mv caddy /usr/bin/

Test that it worked:

caddy version

Create a group named caddy:

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:

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:

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:

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

Homebrew

Note: This is a community-maintained installation method.

brew install caddy

View the Homebrew formula

Webi

Note: This is a community-maintained installation method.

Linux and macOS:

curl -sS https://webinstall.dev/caddy | bash

Windows:

curl.exe -A MS https://webinstall.dev/caddy | powershell

You may need to adjust the Windows firewall rules to allow non-localhost incoming connections.

View on Webi

Chocolatey

Note: This is a community-maintained installation method.

choco install caddy

View the Chocolatey package