How To Build Caddy From Source
Updated by Linode Written by Linode
Caddy is a fast, open-source and security-focused web server written in Go. Caddy includes modern features such as support for virtual hosts, minification of static files, and HTTP/2. Caddy is also the first web-server that can obtain and renew SSL/TLS certificates automatically using Let’s Encrypt.
Caddy has recently updated their license, clearly defining what is considered personal or enterprise use. A commercial license is now required for commercial or enterprise use, including any installation that uses precompiled Caddy binaries. However, because the project is Apache licensed, by building it from source you have access to the original, Apache-licensed web server..
You will need a current version of Go on your Linode. Read our guide on installing Go.
Print your Go installation’s current
go env GOPATH
Pull Caddy from the source. Replace
$GOPATHwith the path retrieved in the previous step.
cd $GOPATH/src go get -u github.com/mholt/caddy go get -u github.com/caddyserver/builds
Navigate to the Caddy directory and start the build:
cd $GOPATH/src/github.com/mholt/caddy/caddy go run build.go -goos=linux -goarch=amd64
When the build finishes you will have a Caddy binary in the current directory. Move the binary to
/usr/binso that Caddy can function correctly:
sudo cp caddy /usr/bin/
Caddy is now installed on your Linode. Read our guide on Installing and Configuring Caddy to learn more about Caddy.
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
Join our Community
This guide is published under a CC BY-ND 4.0 license.