# How to change SSL certificate of the main domain?

**URL:** https://support.stalw.art/t/how-to-change-ssl-certificate-of-the-main-domain/1876
**Category:** Questions
**Created:** [October 5, 2026, 2:08pm UTC](https://support.stalw.art/t/how-to-change-ssl-certificate-of-the-main-domain/1876 "2026-10-05T14:08:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![TurabG](https://support.stalw.art/user_avatar/support.stalw.art/turabg/32/623_2.png) [@TurabG](https://support.stalw.art/u/TurabG)
#### Post date: [October 5, 2026, 2:08pm UTC](https://support.stalw.art/t/how-to-change-ssl-certificate-of-the-main-domain/1876/1 "2026-10-05T14:08:19Z")

</div>

### Your question

I had problems with enabling the ACME method for the main domain ([mail.example.com](http://mail.example.com)), because I had to re-install Stalwart from scratch for I could not upgrade from 0.15.x to 0.16. So when I first installed Stalwart 0.16, Let’s Encrypt did not issue a certificate for this domain due to rate limits.

So I used a manual ZeroSSL certificate for [mail.example.com](http://mail.example.com). Then when the limits reset for Let’s Encrypt, I changed the domain’s DNS management to automatic and had a DNS-01 challenged wildcard certificate (\*.example.com, [mail.example.com](http://mail.example.com))

Now the two certificates are installed and ZeroSSL is serving [mail.example.com](http://mail.example.com) but it’s coming to the end of its validity. Stalwart admin panel wouldn’t let me delete this ZeroSSL certificate as it’s in use.

So the question is, how can I change the certificate Stalwart is served, to the new wildcard certificate that’s present on the panel?

### I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

---

<div class="post-metadata">

### Author: ![helpbot](https://support.stalw.art/user_avatar/support.stalw.art/helpbot/32/13_2.png) [@helpbot](https://support.stalw.art/u/helpbot)
#### Post date: [October 5, 2026, 2:08pm UTC](https://support.stalw.art/t/how-to-change-ssl-certificate-of-the-main-domain/1876/2 "2026-10-05T14:08:43Z")

</div>

This is the answer. Let me read the certificates.md doc fully for clarity.

Since Stalwart doesn’t assign certificates per-domain in config, selection happens automatically via SNI matching against the SAN list of every certificate stored in the system; when more than one certificate matches a hostname, the server logs `tls.multiple-certificates-available` and just picks the first match, which isn’t something you can force from the UI. The actual “in use” certificate that blocks deletion is almost certainly the one referenced by **`defaultCertificateId`** on the `SystemSettings` singleton (Settings › Network › General), which is the certificate served as the fallback whenever a client doesn’t send SNI, and is also what the WebUI considers “in use.”

To switch over:

1. Open **Settings › Network › General** in the WebUI and find the `defaultCertificateId` field.
2. Change it from the old ZeroSSL certificate to the new wildcard Certificate record.
3. Save, then try deleting the ZeroSSL certificate again, it should no longer be referenced and the delete should succeed.

If it’s still blocked after that, check whether any `Http` or `NetworkListener`/reverse-proxy related object elsewhere references that certificate explicitly, since any live reference will keep it from being deletable.

Reference: [Certificates | Stalwart](https://stalw.art/docs/server/tls/certificates/)

_This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong._
