Skip to main content

Installing Caddy

Caddy is distributed as a single binary with no dependencies. This guide covers all installation methods across different platforms.
See our online documentation for the most up-to-date installation instructions.

Quick Install

The simplest, cross-platform way to get started:
1

Download from GitHub

Download Caddy from GitHub Releases and place the executable file in your PATH.
2

Verify Installation

Platform-Specific Installation

Debian/Ubuntu/Raspbian

Using the official Cloudsmith repository:

Fedora/RHEL/CentOS

Arch Linux

Manual Installation (Any Linux)

On Linux, Caddy needs special permissions to bind to ports 80 and 443. Use setcap as shown above.

Building from Source

Building from source gives you the latest features and allows for customization.

Requirements

For Development

These steps will not embed proper version information. For production builds, use the method in the next section.

Setting Capabilities (Linux)

After building, grant permission to bind to low ports:

Using go run (Development)

You can still use go run with setcap:
To avoid typing your password for setcap, you can configure sudoers to allow passwordless execution of /usr/sbin/setcap for your user. See the README for details.

Running Tests

Building with Version Information and Plugins

For production builds with proper version info and custom plugins, use xcaddy.

Using xcaddy

xcaddy is Caddy’s official builder tool.
1

Install xcaddy

2

Build Caddy

This creates a caddy binary in the current directory with proper version information.
3

Build with Plugins

Add custom plugins:
4

Build Specific Version

Pin to a specific Caddy version:

What xcaddy Does

The xcaddy build command automates these steps:
  1. Create a new folder: mkdir caddy
  2. Change into it: cd caddy
  3. Copy Caddy’s main.go and add imports for custom plugins
  4. Initialize a Go module: go mod init caddy
  5. (Optional) Pin Caddy version: go get github.com/caddyserver/caddy/v2@version
  6. (Optional) Add plugins by adding their import: _ "import/path/here"
  7. Compile: go build -tags=nobadger,nomysql,nopgx

System Service Setup

Linux (systemd)

Create a systemd service for Caddy:
This creates and enables a systemd service. Then:

macOS (launchd)

Create a launch agent at ~/Library/LaunchAgents/com.caddy.server.plist:
Then:

Windows Service

Use the built-in service management:

Configuration Locations

Caddy stores data in platform-specific locations:
  • Config: $XDG_CONFIG_HOME/caddy/ or ~/.config/caddy/
  • Data: $XDG_DATA_HOME/caddy/ or ~/.local/share/caddy/
  • Certificates: ~/.local/share/caddy/certificates/

Environment Variables

Caddy respects several environment variables:
View all environment info:
Example output:

Verifying Installation

1

Check Version

2

List Modules

This shows all available modules including any plugins you’ve added.
3

Test Configuration

4

Run a Test Server

Visit http://localhost:2015 to confirm Caddy is working.

Updating Caddy

Uninstalling Caddy

Uninstalling Caddy does not remove configuration files or certificates. To completely remove all Caddy data, also delete the config and data directories.

Troubleshooting Installation

Permission Issues (Linux)

PATH Issues

If caddy command is not found:

Version Mismatch

If you have multiple Caddy installations:

Next Steps

Quick Start

Get your first site running with Caddy

Caddyfile Tutorial

Learn Caddy’s configuration syntax

Automatic HTTPS

Understand how automatic HTTPS works

Community Forum

Get help from the community