# Set up Let’s Encrypt with multiple domains / redirects

**URL:** https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685
**Category:** Sysadmins
**Tags:** how-to, letsencrypt
**Created:** [1 februari 2017 om 02:21 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685 "2017-02-01T02:21:03Z")
**Posts on this page:** 13
**Page:** 6

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [20 augustus 2025 om 14:27 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/176 "2025-08-20T14:27:34Z")

</div>

> [@Paul\_King](#):
>
> Would be even better if there was some clever way for discourse to write the aliases supplied by admin to app.yml itself when next updating,

Not likely. It’s the kind of thing that you’re likely to do exactly once, and you’ll do it when you’re already mucking with `app.yml`.

I’ll see about making a PR that adds it to the `standalone.yml`, though.

[https://github.com/discourse/discourse\_docker/pull/995](https://github.com/discourse/discourse_docker/pull/995)

And with this in place, this is much simpler!

---

<div class="post-metadata">

### Author: ![znedw](https://avatars.discourse-cdn.com/v4/letter/z/b5e925/32.png) [@znedw](https://meta.discourse.org/u/znedw)
#### Post date: [22 augustus 2025 om 23:46 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/177 "2025-08-22T23:46:50Z")

</div>

bedankt hiervoor, ik heb lokaal `templates/web.letsencrypt.ssl.template.yml` aangepast, maar dit maakt mijn leven zoveel gemakkelijker!

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [24 augustus 2025 om 23:16 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/178 "2025-08-24T23:16:33Z")

</div>

> [@featheredtoast](#):
>
> of the form `DISCOURSE_HOSTNAME_ALIASES: domain.com,other.domain.com` to set up alternate hostnames.

Do we need to include the (OG) hostname in this, or just the aliases?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [25 augustus 2025 om 00:41 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/179 "2025-08-25T00:41:38Z")

</div>

Alleen de aliassen. De hostnaam is de hostnaam.

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [25 augustus 2025 om 01:11 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/180 "2025-08-25T01:11:26Z")

</div>

Dus zo dan?

```yml
env:
  DISCOURSE_HOSTNAME: domain.com
  DISCOURSE_HOSTNAME_ALIASES: www.domain.com,otherdomain.org,www.otherdomain.org

```

---

<div class="post-metadata">

### Author: ![Paul\_King](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paul_king/32/165426_2.png) [@Paul\_King](https://meta.discourse.org/u/Paul_King)
#### Post date: [25 augustus 2025 om 01:54 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/181 "2025-08-25T01:54:59Z")

</div>

Wrestling philosophically with the meaning of ‘alias’, I included both urls that I want to lead to my site: [nzarchitecure.net.nz](http://nzarchitecure.net.nz) and [www.nzarchitecture.net.nz](http://www.nzarchitecture.net.nz) with no obvious ill effects (& presumably no benefit either).

---

<div class="post-metadata">

### Author: ![Paul\_King](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paul_king/32/165426_2.png) [@Paul\_King](https://meta.discourse.org/u/Paul_King)
#### Post date: [27 augustus 2025 om 03:34 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/182 "2025-08-27T03:34:43Z")

</div>

Kan `standalone.yml` worden gewijzigd door of opgedragen worden om beheerdersinstellingen te lezen binnen een draaiende instantie van Discourse?  
Zo ja, dan zou dat een grote hulp zijn voor nieuwe gebruikers en degenen die domeinen willen migreren of aliassen willen toevoegen - één zorg minder om te onderzoeken en op te lossen.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [27 augustus 2025 om 13:39 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/183 "2025-08-27T13:39:56Z")

</div>

> [@Paul\_King](#):
>
> Can `standalone.yml` be altered by or tasked to read administrator settings within a running instance of Discourse?

No. It would be really bad if the jobs running in the container could change things like `app.yml`. Actually, a good security practice is to put stuff like S3 keys in the yml file so that they are hidden from the Discourse interface.

> [@Paul\_King](#):
>
> If so that would be a real help to new users and those looking to migrate domains or add aliases - one less headache to research and troubleshoot.

Again, it’s very rare that you make changes like what domains need to be redirected, and they require other things, like DNS settings. The time to do it is when you set up Discourse, and when you set up Discourse, you’re mucking with the yml file.

---

<div class="post-metadata">

### Author: ![philh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/philh/32/532740_2.png) [@philh](https://meta.discourse.org/u/philh)
#### Post date: [15 december 2025 om 18:20 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/184 "2025-12-15T18:20:40Z")

</div>

> [@brahn](#):
>
> ` DISCOURSE_HOSTNAME_ALIASES: domain.com,other.domain.com`

This was asked and answered but it seems DISCOURSE\_HOSTNAME\_ALIASES: [domain.com](http://domain.com),[other.domain.com](http://other.domain.com) is required not just the alias as in DISCOURSE\_HOSTNAME\_ALIASES: [other.domain.com](http://other.domain.com)

Can someone confirm please?

Also, it looks the PR by @pfaffman was not merged so the sample templates need a manual change, yes?

> [@pfaffman](#):
>
> I’ll see about making a PR that adds it to the `standalone.yml`, though.
> 
> [add hostname aliases to templates by pfaffman · Pull Request #995 · discourse/discourse\_docker · GitHub](https://github.com/discourse/discourse_docker/pull/995)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [15 december 2025 om 18:40 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/185 "2025-12-15T18:40:25Z")

</div>

> [@philh](#):
>
> This was asked and answered but it seems DISCOURSE\_HOSTNAME\_ALIASES: [domain.com](http://domain.com),[other.domain.com](http://other.domain.com) is required not just the alias as in DISCOURSE\_HOSTNAME\_ALIASES: [other.domain.com](http://other.domain.com)

No. The example is confusing. Only EXTRA names need to be in `DISCOURSE_HOSTNAME_ALIASES`.

You don’t need `DISCOURSE_HOSTNAME_ALIASES` at all unless you need your site to have a certificate for another name (like yesterday when I moved someone from `forum.example.com` to `fancyword.example.com`.

So I did

```plaintext
DISCOURSE_HOSTNAME: fancyword.example.com
DISCOURSE_HOSTNAME_ALIASES: forum.example.com

```

And backed up the forum before making the changes, made the changes, rebuilt, restored the backup (the restorer handles fixing up the hostname refences) and now if you go to `forum.example.com` you get a valid cert and redirected to the new subdomain.

Yes, it looks like no one noticed the PR. I always have to go looking for this. Sure, `DISCOURSE_HOSTNAME_ALIASES` is “obvious” but only when I’m looking at it. 😿

---

<div class="post-metadata">

### Author: ![philh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/philh/32/532740_2.png) [@philh](https://meta.discourse.org/u/philh)
#### Post date: [15 december 2025 om 19:24 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/186 "2025-12-15T19:24:47Z")

</div>

Thank you for that @pfaffman

In my case I need this to make AWS CDN and AWS S3 CDN work properly with caching

```plaintext
DISCOURSE_HOSTNAME: fancyword.example.com
DISCOURSE_HOSTNAME_ALIASES: cloudfront.example.com

```

Creating multiple certs is exactly what we needed/ Unfortunately we hammered the account with certbot way too many time yesterday so it is time jail for that site. Going to try with a different site now that you have confirmed proper use of DISCOURSE\_HOSTNAME\_ALIASES

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [15 december 2025 om 19:53 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/187 "2025-12-15T19:53:03Z")

</div>

> [@philh](#):
>
> In my case I need this to make AWS CDN and AWS S3 CDN work properly with caching

Then you need to do that at AWS.

> [@philh](#):
>
> Creating multiple certs is exactly what we needed/ Unfortunately we hammered the account with certbot way too many time yesterday so it is time jail for that site.

If you add another alias then it’ll let you request a new one (unless you did something to get the whole domain blocked)

---

<div class="post-metadata">

### Author: ![philh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/philh/32/532740_2.png) [@philh](https://meta.discourse.org/u/philh)
#### Post date: [16 december 2025 om 02:52 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/188 "2025-12-16T02:52:10Z")

</div>

> [@pfaffman](#):
>
> > [@philh](#):
> >
> > In my case I need this to make AWS CDN and AWS S3 CDN work properly with caching
> 
> Then you need to do that at AWS.

Looks like this may not be needed after all. Caching seem to be working. I will update with details at [Issues with AWS CDN and S3](https://meta.discourse.org/t/issues-with-aws-cdn-and-s3/391132)

[Vorige pagina](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685.md?page=5)
