Add a domain and its DNS records
Serve another domain from the box, see the DNS records its owner publishes for web and mail, and choose which domain carries the apps.
Every company domain the box serves is in the state file with the company it belongs to. The box does not register domains and does not change DNS for you: you, or whoever owns the domain, publish the records at the domain's DNS host. thx prints exactly what to publish.
Steps
- Add the domain and say which company it belongs to:
sudo thx domain add acme.example --org acme. Domain names must be lowercase. - Apply:
sudo thx apply. Caddy starts answering for the domain and itswww.name, and asks Let's Encrypt for certificates as soon as DNS points at the box. - Print the mail records:
sudo thx dns acme.example. Publish each required record at the DNS host. The DNS records reference shows the full output for an example domain, with what each record is for. - Point the web names at the box: an
Arecord formail.acme.example(it is in thethx dnsoutput), and, only if you want the box to answer there, anArecord for the apex andwww. - Check the list:
sudo thx domain ls.
What the box serves on a company domain
acme.example: a placeholder page that says nothing is published there yet, until you serve a website on it withthx site add. If the company already has a website elsewhere, leave the apexArecord alone: the box never needs it.www.acme.example: a permanent redirect to the apex.mail.acme.example,autoconfig.acme.exampleandautodiscover.acme.example: the mail server's name, and the names mail clients look up to configure themselves.
The apps domain
One served domain is also the apps domain, set with sudo thx set site_domain acme.example. Every app lives under it: app.acme.example, crm.acme.example, drive.acme.example and so on. The domain must already be on the box. The set-up wizard checks for a wildcard record, * A pointing at the box's public IP, on the apps domain before it installs the apps, because each app name needs its own certificate. Clearing it with sudo thx set site_domain '' and applying drops every app address from Caddy's configuration, and the IP address serves the set-up wizard again.
Mail records in short
thx dns prints five required records and some optional ones:
| Record | Why |
|---|---|
A for mail. | the mail server's address; never proxied by a CDN |
MX | where the internet delivers the domain's mail |
TXT SPF | lets the cloud provider's email service send as the domain; merge with an existing SPF record, never publish two |
CNAME DKIM | the email service signs outgoing mail; copy name and value from your cloud console |
TXT DMARC | starts at p=none; tighten it once real mail passes SPF and DKIM |
The DKIM record appears only after you record it with thx relay dkim, described in mail and the relay.
Removing a domain
sudo thx domain rm acme.example stops serving it. The domain that is the apps domain cannot be removed until you clear site_domain. Mail already received for the domain stays in the mailboxes.
Moving the apps to another domain
Add the new domain, then make it the apps domain and apply:
sudo thx domain add newname.example --org acme
sudo thx set site_domain newname.example
sudo thx apply
Every app moves to <app>.newname.example, and noreply@ and the box's own accounts follow by themselves. People keep the addresses they had; give them new ones with thx user alias add. Everyone signs in again on the new domain. Authenticator-app codes keep working, but passkeys and security keys belong to the old domain, so each person registers theirs again. When nothing uses the old domain any more, remove it as described above.