# 在浏览器地址栏中使用外部域名

**URL:** https://meta.discourse.org/t/using-external-domain-in-the-browser-address-line/205827
**Category:** Self-hosting
**Created:** [2021年十月12日 10:09 UTC](https://meta.discourse.org/t/using-external-domain-in-the-browser-address-line/205827 "2021-10-12T10:09:52Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ITAS-Isti](https://avatars.discourse-cdn.com/v4/letter/i/87869e/32.png) [@ITAS-Isti](https://meta.discourse.org/u/ITAS-Isti)
#### Post date: [2021年十月12日 10:09 UTC](https://meta.discourse.org/t/using-external-domain-in-the-browser-address-line/205827/1 "2021-10-12T10:09:52Z")

</div>

您好，

我们将 Discourse 安装迁移到了内部虚拟机，该虚拟机使用 SNI（因为该虚拟机没有唯一的 IPv4 地址）。因此，我们使用了 CNAME 将外部域名转发到该虚拟机。  
转发本身运行正常，但访问者在地址栏中看到的却是内部加密的主机名，而不是他们之前打开的生产环境 URL。

请问是否有任何方法可以在 Discourse 中使用外部域名？

感谢您的简短确认。

此致  
I.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2021年十月12日 10:40 UTC](https://meta.discourse.org/t/using-external-domain-in-the-browser-address-line/205827/2 "2021-10-12T10:40:49Z")

</div>

> [@ITAS-Isti](#):
>
> 因此，我们已为转发到虚拟机的外部域名使用了 CNAME。  
> 转发本身运行良好，但访问者在地址栏中看到的仍是内部晦涩的主机名。

1. 由于正在使用 SNI，因此没有理由使用 CNAME。
2. 如果访问者看到的是内部主机名，那么您可能根本没有使用 CNAME，而是设置了某种重定向。

如果您需要进一步的建议，请提供确切的主机名。

---

<div class="post-metadata">

### Author: ![ITAS-Isti](https://avatars.discourse-cdn.com/v4/letter/i/87869e/32.png) [@ITAS-Isti](https://meta.discourse.org/u/ITAS-Isti)
#### Post date: [2021年十月12日 13:11 UTC](https://meta.discourse.org/t/using-external-domain-in-the-browser-address-line/205827/3 "2021-10-12T13:11:57Z")

</div>

你好，Richard，

非常感谢您的回复。

大学的信息技术部门已告知我们，CNAME 是我们唯一的选择……

我的配置如下：

 ![discourse](https://global.discourse-cdn.com/meta/original/3X/6/b/6b717f083266c7a78567a5af00f9f049a9d0e4d7.jpeg)

此致

I

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2021年十月12日 15:50 UTC](https://meta.discourse.org/t/using-external-domain-in-the-browser-address-line/205827/4 "2021-10-12T15:50:00Z")

</div>

您需要在 `app.yml` 中使用 `discourse.itas-karlsruhe.de` 作为主机名，而不是内部名称。

请参阅 [Change the domain name or rename your Discourse](https://meta.discourse.org/t/change-the-domain-name-or-rename-my-discourse/16098)

---

<div class="post-metadata">

### Author: ![ITAS-Isti](https://avatars.discourse-cdn.com/v4/letter/i/87869e/32.png) [@ITAS-Isti](https://meta.discourse.org/u/ITAS-Isti)
#### Post date: [2021年十月12日 17:48 UTC](https://meta.discourse.org/t/using-external-domain-in-the-browser-address-line/205827/5 "2021-10-12T17:48:52Z")

</div>

非常感谢，这很有帮助 🙂

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2021年十一月11日 17:49 UTC](https://meta.discourse.org/t/using-external-domain-in-the-browser-address-line/205827/6 "2021-11-11T17:49:43Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
