Build from source
- Go 1.14 or newer
Clone the repository:
If you don’t have git, you can download the source code as a file archive . Each release also has source snapshots.
Build:
go build
Due to , these basic steps do not embed version information. If you want the version (caddy version
), you need to compile Caddy as a dependency rather than as the main module. Instructions for this are in Caddy’s main.go file. Or, you can use xcaddy which automates this.
Requirements:
- Go installed (see above)
- Make sure is in your PATH
You do not need to download the Caddy source code (it will do that for you).
Then building Caddy (with version information) is as easy as:
To build with plugins, use --with
:
--with github.com/caddyserver/nginx-adapter
--with github.com/caddyserver/ntlm-transport@v0.1.1
Cross-platform compilation with xcaddy
works the same as with the command (see below).
Cross-platform
Go programs are easy to compile for other platforms. Just set the GOOS
, GOARCH
, and/or GOARM
environment variables that are different. ()
For example, to compile Caddy for Windows when you’re not on Windows:
Or similarly for Linux ARMv6 when you’re not on Linux or on ARMv6:
GOOS=linux GOARCH=arm GOARM=6 go build