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
- Linux
- macOS
- Windows
- Docker
Building from Source
Building from source gives you the latest features and allows for customization.Requirements
For Development
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, usexcaddy.
Using xcaddy
xcaddy is Caddy’s official builder tool.1
Install xcaddy
2
Build Caddy
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
Thexcaddy build command automates these steps:
- Create a new folder:
mkdir caddy - Change into it:
cd caddy - Copy Caddy’s main.go and add imports for custom plugins
- Initialize a Go module:
go mod init caddy - (Optional) Pin Caddy version:
go get github.com/caddyserver/caddy/v2@version - (Optional) Add plugins by adding their import:
_ "import/path/here" - Compile:
go build -tags=nobadger,nomysql,nopgx
System Service Setup
Linux (systemd)
Create a systemd service for Caddy:macOS (launchd)
Create a launch agent at~/Library/LaunchAgents/com.caddy.server.plist:
Windows Service
Use the built-in service management:Configuration Locations
Caddy stores data in platform-specific locations:- Linux
- macOS
- Windows
- Docker
- 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:Verifying Installation
1
Check Version
2
List Modules
3
Test Configuration
4
Run a Test Server
http://localhost:2015 to confirm Caddy is working.Updating Caddy
- Package Manager
- Manual Update
- Docker
- xcaddy Rebuild
Uninstalling Caddy
- Debian/Ubuntu
- Fedora/RHEL
- macOS
- Windows
Troubleshooting Installation
Permission Issues (Linux)
PATH Issues
Ifcaddy 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