将您的托管Discourse网站配置为在根域名(例如example.com)运行

Most hosted discourse instances are on a subdomain:

forum.example.com
talk.example.com
www.example.com

This is our general recommendation in almost all cases, and it works great. However, if you wish to use a root domain or apex domain for your hosted discourse, like so

example.com

this turns out to be surprisingly difficult in a hosting scenario, due to the vagaries of how DNS works. :thinking:

It is possible, however, you must use a DNS provider that specifically supports it!

DNS provider documentation

Here is a list of known-compatible DNS providers, the name of the DNS type that you should use, and a link to their docs.

Provider Type
AWS Route53 (AWS only[1]) A & AAAA ALIAS records; click for example →
CloudFlare CNAME flattening · Cloudflare DNS docs
DNSimple ALIAS
DNS Made Easy ANAME
DreamHost ALIAS
easyDNS ANAME
Gandi ALIAS
Hurricane Electric ALIAS
Name ANAME
Namecheap ALIAS
Webcentral (formerly Netregistry) Cloaked Redirection (IPv4 only)
PointDNS ALIAS

If your DNS provider is not one of the above, you must switch to one of these DNS providers to achieve an apex domain or root domain hosted discourse.

:exclamation: If you try/test out another DNS provider and it works for you, do reply here with the name of the DNS provider, and a link that explains how they set it up, so we can update our list. There are a lot of DNS providers, so we update the list as we find, this list is by no way a one-stop-list of every DNS provider in the world that supports this.


Last Reviewed by @SaraDev on 2022-07-12T01:00:00Z


  1. this only works if you are self-hosted in AWS or on our AWS Enterprise Hosting ↩︎

Last edited by @JammyDodger 2024-05-26T07:47:45Z

Check documentPerform check on document:
36 个赞

帖子已拆分为新主题:必需的 DNS 设置

花了点时间才弄明白,但我成功地让我的 apex 域名与 Azure 配合使用,我们在那里托管 DNS。

要使用 Azure,您需要利用 Azure Front Door。这些说明适用于 Azure Front Door Standard/Premium,而不是 Azure Front Door (classic)。

  1. 导航到 Azure Front Door,然后单击 + 创建
  2. 选择 Azure Front Door自定义创建,然后单击 继续创建 Front Door
  3. 选择您的订阅、资源组、名称和层(Standard 对我来说效果很好),然后单击 下一步:密钥
  4. 如果您使用的是自己的 SSL 证书,请在此处添加。添加后(或者如果您让 Azure 创建您的证书),单击 下一步:终结点
  5. 单击 添加终结点 并选择一个名称,然后单击 添加
  6. 在新的“路由”部分下,单击 添加路由。给它起一个名字。
  7. 对于“源组”,单击 添加新的源组。给它起一个名字。
  8. 单击 + 添加源。给它起一个名字。对于“源类型”,选择 自定义。对于“主机名”,输入您的 site.hosted-by-discourse.com 域名。确保“源主机标头”为空。单击 添加
  9. 在“添加源组”对话框中单击 添加
  10. 在“添加路由”对话框中单击 添加
  11. 单击 审阅 + 创建。单击 创建
  12. 等待 AFD 部署。部署完成后,单击 转到资源
  13. 在左侧菜单中选择 域名。单击 添加域名
  14. 对于“DNS 区域”,选择您的域名所在的区域。在“自定义域名”下,在 APEX 部分选择您的域名。单击 添加
  15. 当您的域名出现在列表中时,单击右侧的 。选择 关联
  16. 选择您之前创建的终结点和路由。单击 关联

如果您使用的是 AFD 托管证书

  1. 如果域名的“验证状态”为 待定,请单击该链接。选择“TTL 单位”的 分钟(以便快速验证),然后单击“DNS 记录状态”下的 添加 按钮。
  2. 请耐心等待。这是我花费过多时间抓耳挠腮的地方,但您需要等待。最终,“验证状态”应更改为 已批准
  3. 您可能需要重新生成并更新 TXT DNS 记录。您可以通过单击 重新生成 按钮来执行此操作。一旦出现“DNS 记录状态”下的 更新 按钮,您就需要单击它。
1 个赞

[引用=“rey.riel, 第13楼, 话题: 60951”]
为了使用Azure,您需要利用Azure Front Door。这些指令适用于Azure Front Door Standard/Premium,而不是Azure Front Door(经典版)。
[/引用]

供任何关注此事的人参考:此设置并不是在平衡DNS,而是在Azure中配置一个负载均衡器以代理源。

这不是官方支持的,因为它会产生副作用(所有访问者都来自Azure IP,而非他们的实际IP)

1 个赞