Nov 25, 2022 1 min read

Caddy Free Web Server with Automatic SSL

Caddy Free Web Server with Automatic SSL
Caddy Server 2 alternate to apache and nginx
Table of Contents

Caddy is a powerful, extensible platform to serve your sites, services, and apps, written in Go.


Debian, Ubuntu, Raspbian

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf '' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf '' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy

Create Caddy Service

sudo systemctl enable caddy

Edit CaddyFile

sudo vim /etc/caddy/Caddyfile

Add the Below lines to Caddyfile Config {
	reverse_proxy localhost:5000
In this tutorial, replace with your actual domain name.

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

Before continuing, verify the correct records with an authoritative lookup. Replace with your domain name, and if you are using IPv6 replaces type=A with type=AAAA:

curl "" \
  -H "accept: application/dns-json"

Also, make sure your server is externally reachable on ports 80 and 443 from a public interface.

Start Caddy Server

Then from the same directory, run:

sudo caddy stop
sudo caddy start

You can use caddy reload to reload the config live.

You will see Caddy provision a TLS certificate and serve your site over HTTPS. This was possible because your site's address in the Caddyfile contained a domain name.

For More Information visit

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to BugFix.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.