HTTPS in 2 Minutes
This guide will get a simple production site on HTTPS in about 2 minutes.
- 🔲 Set DNS records
- 🔲 Start Caddy
- 🔲 Check that it works
- 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.