This page is about Caddy 2, which is currently in beta. Click here for the old Caddy 1 site. Thank you for your patience as we transition!
Documentation
Caddy 2 is beta software. It is used in production, but some things will change; check the release notes before upgrading.

HTTPS in 2 Minutes

This guide will get a simple production site on HTTPS in about 2 minutes.

Objectives:

  • 🔲 Set DNS records
  • 🔲 Start Caddy
  • 🔲 Check that it works

Prerequisites:

  • Basic terminal / command line skills
  • Basic DNS knowledge
  • Caddy installed in server's PATH
  • A registered domain name

Set your domain's A/AAAA records point to your server. You can do this by logging into your DNS provider and managing your domain name.

Optionally verify with an authoritative lookup:

curl "https://cloudflare-dns.com/dns-query?name=example.com&type=A" \
  -H "accept: application/dns-json"

Additionally, make sure your server is publicly reachable on ports 80 and 443.

Run this command to start a production-ready file server, replacing the parameters with your own values:

caddy file-server --domain example.com --path /site/root

You should see Caddy get a certificate and start serving your site.

Then you can verify that it is working:

curl -v example.com

(Or load it in your browser.) You will see that Caddy automatically redirects HTTP to HTTPS for you. It will also keep your TLS certificate renewed as long as it is running and the domain is pointed at your machine.