How To Build Caddy From Source

Updated by Linode Written by Linode

Contribute on GitHub

Report an Issue | View File | Edit File

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..

Build Caddy

You will need a current version of Go on your Linode. Read our guide on installing Go.

  1. Pull Caddy from the source. If you followed our guide on installing Go, the $GOPATH is /usr/local/go, otherwise use $GOPATH/drc

    cd $GOPATH/src
    go get -u github.com/mholt/caddy
    go get -u github.com/caddyserver/builds
    
  2. Navigate to the Caddy directory and start the build:

    cd $GOPATH/src/go/src/github.com/mholt/caddy
    go run build.go -goos=linux -goarch=amd64
    
  3. When the build finishes you will have a Caddy binary in the current directory. Move the binary to /usr/bin so 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.

More Information

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

Find answers, ask questions, and help others.

comments powered by Disqus

This guide is published under a CC BY-ND 4.0 license.