Caddy
Caddy
by Caddy

Version 2.1.1

OS Ubuntu 18.04

DEVELOPER TOOLS

Description

Caddy is an open source web server and reverse proxy, written in Go. It is the only web server to use HTTPS automatically and by default, which means that Caddy obtains and renews TLS certificates for all your sites. The Caddyfile makes it easy to configure manually, while its powerful API makes configuration highly dynamic and programmable.

Software Included

Getting started after deploying Caddy

After your droplet is created, you can visit its IP address in your browser, where you will see a welcome page that will guide you to a functional site:

  1. Point your domain's A/AAAA records at your droplet's IP address(es).

  2. Upload your site's files to /var/www/html.

  3. Edit your Caddyfile at /etc/caddy/Caddyfile:

    • Replace :80 with your domain name
    • Change the site root to /var/www/html
  4. Reload the configuration: systemctl reload caddy

That's all there is to it! Caddy does the rest. It will keep your certificates renewed while it serves your sites, and it even redirects HTTP requests to HTTPS.

To make sure it worked, simply visit your site in your browser by using your domain name! Note that it may take up to a minute for Caddy to obtain a TLS certificate. If there were any problems, the welcome page has some suggestions. Usually errors on first run are related to improper DNS configuration, slow DNS propagation, or misconfigured ports/firewalls.

You can additionally set up more features in the Caddyfile such as compression, reverse proxying, template evaluation, and much more. It also has an API if you want to programmatically manage its configuration.

See the Caddy 2 documentation for details.

API Creation

In addition to creating a Droplet from the Caddy 1-Click App via the control panel, you can also use the DigitalOcean API.

As an example, to create a 4GB Caddy Droplet in the SFO2 region, you can use the following curl command. You’ll need to either save your API access token to an environment variable or substitute it into the command below.


  curl -X POST -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer '$TOKEN'' -d \
      '{"name":"choose_a_name","region":"sfo2","size":"s-2vcpu-4gb","image":"caddy-18-04"}' \
      "https://api.digitalocean.com/v2/droplets"
      

Support Details

Support URL:https://caddy.community

Additional Links

Documentation

Caddy documentation