# TLS, DNS and test domains for small sites

> How Setu gets HTTPS onto a small server: what DNS has to be true before a certificate can be issued, when to use Caddy's internal CA instead of ACME, and how to switch between them without losing routes.

Published 2026-11-29 · Canonical: https://techgopal.com/post/tls-dns-test-domains-small-sites

---

> **Summary.** HTTPS on a small server fails for boring reasons: the DNS name does not point at the machine yet, port 80 or 443 is closed, or you are testing on a name that does not exist. Setu puts Caddy in front of every site and gives you two modes: ACME certificates for real names, and Caddy's internal CA for everything else. This post covers what must be true for each mode, the one trap with the internal CA (browsers do not trust it), and how to switch modes later without losing a single site route. It describes Setu 0.1.6.

## Key facts

## What has to be true for a real certificate

Setu's install notes put the requirement in one sentence: you need root, ports 80 and 443 open, and a DNS name pointing at the server. That is not Setu being picky. It is what any ACME client needs in order to prove you control the name. If one of the three is missing, Caddy cannot get a certificate and the site will not serve valid HTTPS.

Check in this order before blaming anything else:

1. **DNS.** Does the name resolve to this machine's public address? A record changes can take time to reach the resolver you are using, so test from outside the server.
2. **Ports.** Are 80 and 443 reachable from the internet, through both the host firewall and whatever the hosting provider puts in front?
3. **The name Setu was told.** The panel host given at install time is the name Caddy requests a certificate for.

## When there is no DNS name yet: the internal CA

`--tls internal` exists for the first hour of a new server: the name is not set up, or the machine has no public address, and you still want the whole path to work over HTTPS, including the agent joining the control plane.

With `--tls internal`, Caddy issues certificates from its own internal CA instead of ACME. Used alone, the panel host becomes the machine's primary IP address. Used with `--panel-host`, you get an internal-CA certificate for that name.

The trap is trust. Nothing outside the machine trusts that CA, so there are two places you have to deal with it:

- **Browsers** need Caddy's root certificate, which sits at `/var/lib/caddy/.local/share/caddy/pki/authorities/local/root.crt` on the server.
- **Agents on other servers** are told to trust it with `--ca <file>`: a PEM root certificate that is copied to `/etc/setu/ca.pem` and recorded in the agent's configuration. Under `tls internal` the install command the panel prints already carries `--ca`.

There is no flag that turns certificate checking off. `--insecure` only allows plain `http://` to a non-loopback control plane for tests, and it never disables certificate checks.

## Switching modes later

Moving from internal to ACME, once the DNS name is ready, is one command on the control-plane box (the machine that hosts the panel; on other servers leave out `--panel-host` and `--upstream`):

```sh
setu agent install-system --panel-host setu.example.com --upstream unix//run/setu/http.sock
```

It rewrites `/etc/caddy/setu.json` and applies it through the admin socket, keeping every site route. On the control-plane box you also record the mode so the wizard's install command matches:

```sh
cd /etc/setu && sudo -u setu setu setting set tls_internal false
```

Changing the panel's name also means editing `public_url` in `setu.toml` and restarting `setu`, and setting `panel.host` in `/etc/setu/agent.toml` and restarting `setu-agent`.

Re-running the installer is not the way to switch. The agent install always joins again and needs a fresh join token, which is the wrong cost for a TLS change.

## If Caddy loses its configuration

Every site has a recorded domain. On start, and then at a fixed interval, the agent compares what Caddy has against what the site records say and puts back any route that is missing. The reverse also holds: a `setu-site-*` route whose site is unknown or has no domain is removed, while routes Setu did not write are never touched. That is how a Caddy that restarted without its configuration ends up serving your sites again without you doing anything. (Site directories and databases are a separate matter: leftovers there are logged and never deleted.)

## What I do not claim

- This is a design description, not a guarantee about your network. If your provider blocks port 80, no panel can fix that.
- Setu does not, as far as the docs and code I have checked go, have a separate "staging" mode for an ACME provider. A test domain in my setup means the internal CA, not a second set of real certificates.
- Small sites are the target. If you need wildcard certificates, many domains per certificate or a DNS-based challenge, check the Setu documentation for what exists before relying on it.

If something here does not match what you see on your own server, please open an issue on the Setu repository.


---

**Feature number:** 008

**Main search phrase:** TLS and DNS for small sites

**Secondary search phrases:** Caddy ACME internal CA, self-hosted HTTPS setup

**Summary (answer first):** How Setu gets HTTPS onto a small server: what DNS has to be true before a certificate can be issued, when to use Caddy's internal CA instead of ACME, and how to switch between them without losing routes.

**Chips:** Setu 0.1.6 | TLS | DNS

