Back to Caddyserver

Install

src/docs/markdown/install.md

latest10.0 KB
Original Source

Install

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

Official:

<aside class="tip">

Our official packages come only with the standard modules. If you need third-party plugins, build from source with xcaddy, use our download page, or deploy on Railway.

</aside>

Community-maintained:

Static binaries

If installing onto a production system, we recommend using our official package for your distro if available below.

  1. Obtain a Caddy binary:
  2. Install Caddy as a system service. This is strongly recommended, especially for production servers.

Place the binary in one of your $PATH (or %PATH% on Windows) directories so you can run caddy without typing the full path of the executable file. (Run echo $PATH to see the list of directories that qualify.)

You can upgrade static binaries by replacing them with newer versions and restarting Caddy. The caddy upgrade command can make this easy.

Debian, Ubuntu, Raspbian

Installing this package automatically starts and runs Caddy as a systemd service named caddy. It also comes with an optional caddy-api service which is not enabled by default, but should be used if you primarily configure Caddy via its API instead of config files.

After installing, please read the service usage instructions.

Stable releases:

<pre><code class="cmd"><span class="bash">sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl</span> <span class="bash">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg</span> <span class="bash">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list</span> <span class="bash">sudo chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg</span> <span class="bash">sudo chmod o+r /etc/apt/sources.list.d/caddy-stable.list</span> <span class="bash">sudo apt update</span> <span class="bash">sudo apt install caddy</span></code></pre>

Testing releases (includes betas and release candidates):

<pre><code class="cmd"><span class="bash">sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl</span> <span class="bash">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/testing/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-testing-archive-keyring.gpg</span> <span class="bash">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/testing/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-testing.list</span> <span class="bash">sudo chmod o+r /usr/share/keyrings/caddy-testing-archive-keyring.gpg</span> <span class="bash">sudo chmod o+r /etc/apt/sources.list.d/caddy-testing.list</span> <span class="bash">sudo apt update</span> <span class="bash">sudo apt install caddy</span></code></pre>

View the Cloudsmith repos

If you wish to use the packaged support files (systemd services, bash completion and default configuration) with a custom Caddy build, instructions can be found here.

Fedora, RedHat, CentOS

This package comes with both of Caddy's systemd service unit files, but does not enable them by default. Using the service is recommended. If you do, please read the service usage instructions.

Fedora:

<pre><code class="cmd"><span class="bash">dnf install dnf5-plugins</span> <span class="bash">dnf copr enable @caddy/caddy</span> <span class="bash">dnf install caddy</span></code></pre>

CentOS/RHEL:

<pre><code class="cmd"><span class="bash">dnf install dnf-plugins-core</span> <span class="bash">dnf copr enable @caddy/caddy</span> <span class="bash">dnf install caddy</span></code></pre>

View the Caddy COPR

Arch Linux, Manjaro, Parabola

This package comes with heavily modified versions of both of Caddy's systemd service unit files, but does not enable them by default. Those modifications include a custom start/stop behavior and additional sandboxing flags which are explained in systemd's exec documentation, which may lead to certain host directories not being available to the Caddy process.

<pre><code class="cmd"><span class="bash">pacman -Syu caddy</span></code></pre>

View Caddy in the Arch Linux repositories and the Arch Linux Wiki

Docker

<pre><code class="cmd bash">docker pull caddy</code></pre>

View on Docker Hub

See our recommended Docker Compose configuration and usage instructions.

Railway

Through a sponsorship from Railway, we officially support this template:

Gentoo

Note: This is a community-maintained installation method.

<pre><code class="cmd">emerge www-servers/caddy</code></pre>

View Gentoo Package

Homebrew (Mac)

Note: This is a community-maintained installation method.

<pre><code class="cmd bash">brew install caddy</code></pre>

View the Homebrew formula

Chocolatey (Windows)

Note: This is a community-maintained installation method.

<pre><code class="cmd">choco install caddy</code></pre>

View the Chocolatey package

Scoop (Windows)

Note: This is a community-maintained installation method.

<pre><code class="cmd">scoop install caddy</code></pre>

View the Scoop manifest

Webi

Note: This is a community-maintained installation method.

Linux and macOS:

<pre><code class="cmd bash">curl -sS https://webi.sh/caddy | sh</code></pre>

Windows:

<pre><code class="cmd">curl.exe https://webi.ms/caddy | powershell</code></pre>

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

View on Webi

Ansible

Note: This is a community-maintained installation method.

<pre><code class="cmd bash">ansible-galaxy install nvjacobo.caddy</code></pre>

View the Ansible role repository

Termux

Note: This is a community-maintained installation method.

<pre><code class="cmd">pkg install caddy</code></pre>

View the Termux build.sh file

Nix/Nixpkgs/NixOS

Note: This is a community-maintained installation method.

View Caddy in the Nixpkgs search and the NixOS options search

Unikraft

Note: This is a community-maintained installation method.

First install Unikraft's companion tool, kraft:

<pre><code class="cmd">curl --proto '=https' --tlsv1.2 -sSf https://get.kraftkit.sh | sh</code></pre>

Then run Caddy with Unikraft using:

<pre><code class="cmd">kraft run --rm -p 2015:2015 --plat qemu --arch x86_64 -M 256M caddy:2.7</code></pre>

To allow non-localhost incoming connections, you need to connect the unikernel instance to a network.

View the Unikraft application catalog and the KraftCloud platform examples (powered by Unikraft).

OPNsense

Note: This is a community-maintained installation method.

<pre><code class="cmd">pkg install os-caddy</code></pre>

View the FreeBSD caddy-custom makefile and the os-caddy plugin source

Mise

Note: This is a community-maintained installation method.

If you are using mise, the polyglot tool versions manager, you can use a command like this to install the last version:

<pre><code class="cmd">mise use -g caddy@latest</code></pre>