# 为主站（www.example.com）设置 discourse，而不是在子域上

**URL:** https://meta.discourse.org/t/setup-discourse-for-the-main-site-www-example-com-not-on-a-subdomain/205253
**Category:** Support
**Created:** [2021年十月5日 12:08 UTC](https://meta.discourse.org/t/setup-discourse-for-the-main-site-www-example-com-not-on-a-subdomain/205253 "2021-10-05T12:08:40Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2021年十月5日 12:39 UTC](https://meta.discourse.org/t/setup-discourse-for-the-main-site-www-example-com-not-on-a-subdomain/205253/6 "2021-10-05T12:39:35Z")

</div>

我还发现这个提示非常有用，可以帮助让 letsencrypt 证书同时适用于 [www.example.com](http://www.example.com) 和 [example.com](http://example.com) 地址。👍

> [@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/setup-discourse-for-the-main-site-www-example-com-not-on-a-subdomain/205253)._
