# 安装 Let's Encrypt SSL 时 www 和非 www 的问题

**URL:** <https://meta.discourse.org/t/problem-in-installing-lets-encrypt-ssl-for-www-and-non-www/88515>\
**Category:** Self-hosting\
**Created:** [2018年五月26日 18:37 UTC](https://meta.discourse.org/t/problem-in-installing-lets-encrypt-ssl-for-www-and-non-www/88515 "2018-05-26T18:37:22Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![brahn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brahn/32/109267_2.png) [@brahn](https://meta.discourse.org/u/brahn)\
**Post date:** [2018年七月8日 05:37 UTC](https://meta.discourse.org/t/problem-in-installing-lets-encrypt-ssl-for-www-and-non-www/88515/9 "2018-07-08T05:37:01Z")

</div>

> [@Gulshan\_Kumar](#):
>
> Ideally, I would like to have SSL for www and non-www version also.

This is how the Let’s encrypt template requests the certificate:

> <https://github.com/discourse/discourse_docker/blob/master/templates/web.letsencrypt.ssl.template.yml#L59>

Specifically `--issue -d $$ENV_DISCOURSE_HOSTNAME` meaning that it only issues a request for the hostname given to discourse. In order to get both www and non-www you need to adjust the template to issue more than one `-d` argument.

Something like as shown here:  
(read the replies, some adjustments to the original topic are necessary but I am unable to edit it)

> [@Set up Let’s Encrypt with multiple domains / redirects](https://meta.discourse.org/t/setting-up-let-s-encrypt-with-multiple-domains/56685):
>
> NOTE: @pfaffman says: This page needs to be cleaned up. There is now a new ENV setting that will let you add more hostnames. In your app.yml under your DISCOURSE\_HOSTNAME line (it can go many places but that one makes sense), add DISCOURSE\_HOSTNAME\_ALIASES: domain.com,other.domain.com and early reports suggest that you’ll get valid certs for those domains and that accessing https://domain.com will properly redirect you to your DISCOURSE\_HOSTNAME without a certificate error. If you do that an…

---

_[View the full topic](https://meta.discourse.org/t/problem-in-installing-lets-encrypt-ssl-for-www-and-non-www/88515)._
