# 将 Discourse 移至子 URL

**URL:** https://meta.discourse.org/t/put-discourse-on-a-sub-url/157052
**Category:** Support
**Created:** [2020年七月7日 16:39 UTC](https://meta.discourse.org/t/put-discourse-on-a-sub-url/157052 "2020-07-07T16:39:59Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![AntonTkachov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antontkachov/32/186316_2.png) [@AntonTkachov](https://meta.discourse.org/u/AntonTkachov)
#### Post date: [2020年七月7日 16:39 UTC](https://meta.discourse.org/t/put-discourse-on-a-sub-url/157052/1 "2020-07-07T16:39:59Z")

</div>

大家好！

我之前有一个托管在子域名上的 Discourse 设置，一切运行顺畅。现在我们决定将 Discourse 从子域名迁移到子 URL。也就是说，同一个域名将同时用于 Laravel 站点和 `/community` 子 URL 来托管 Discourse。能否请您建议我需要修改哪些设置以及在哪里进行修改，以确保一切正常运行？我具备技术背景，对 Rails 有不错的经验，但不太确定该从哪里入手，以及可能会遇到哪些潜在问题。

提前感谢大家的帮助，期待收到您的回复。

Anton

---

<div class="post-metadata">

### Author: ![JimPas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jimpas/32/148179_2.png) [@JimPas](https://meta.discourse.org/u/JimPas)
#### Post date: [2020年七月7日 18:05 UTC](https://meta.discourse.org/t/put-discourse-on-a-sub-url/157052/2 "2020-07-07T18:05:59Z")

</div>

虽然您可以在子文件夹中安装 Discourse，但会出现一些问题。建议您使用以下链接查看子文件夹安装中遇到的问题。这是可以实现的，但存在挑战。

[https://meta.discourse.org/search?q=installing%20discourse%20on%20subfolders](https://meta.discourse.org/search?q=installing%20discourse%20on%20subfolders)

> [@Generals Subfolder recommendations and tips](https://meta.discourse.org/t/generals-subfolder-recommendations-and-tips/74401):
>
> The app.yml changes currently described in this subfolder support how-to, that complements the [normal installation](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md), have indeed helped me to install Discourse as a subfolder like [example.com/forum](http://example.com/forum) instead of subdomain [forum.example.com](http://forum.example.com) when suitable. However, there was still the problem of port conflict (80, 443), and I had to shut down the rest of the site at [example.com](http://example.com) (WordPress) on the same virtual server (by stopping its Nginx in my case) to be able to run Discourse at [example.com/forum](http://example.com/forum), …

关于此问题已有 50 多个讨论主题。😐

---

<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: [2020年七月7日 22:54 UTC](https://meta.discourse.org/t/put-discourse-on-a-sub-url/157052/3 "2020-07-07T22:54:44Z")

</div>

> [@AntonTkachov](#):
>
> 我们目前决定将 Discourse 从子域名迁移到子 URL。

这是因为你们想在所有链接变更时损失 SEO 权重，还是因为论坛运行得太顺利，需要额外找点活儿干？😉

免费建议的价值取决于你付出的代价，但我建议你三思而后行。虽然有些企业网站使用子文件夹，相关代码维护得相当完善，但在升级时仍需格外小心。

---

<div class="post-metadata">

### Author: ![AntonTkachov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antontkachov/32/186316_2.png) [@AntonTkachov](https://meta.discourse.org/u/AntonTkachov)
#### Post date: [2020年七月8日 14:21 UTC](https://meta.discourse.org/t/put-discourse-on-a-sub-url/157052/4 "2020-07-08T14:21:32Z")

</div>

你好，@pfaffman！

感谢你的合理回应，但事实是，我并不是这项变更的决策者，对最终决定的影响力也很有限。

无论如何，你的回答很有帮助。谢谢。

---

<div class="post-metadata">

### Author: ![AntonTkachov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antontkachov/32/186316_2.png) [@AntonTkachov](https://meta.discourse.org/u/AntonTkachov)
#### Post date: [2020年七月8日 14:25 UTC](https://meta.discourse.org/t/put-discourse-on-a-sub-url/157052/5 "2020-07-08T14:25:33Z")

</div>

实际上，我最初并没有将子 URL 视为子文件夹方案。因此，我并未重点关注子文件夹相关话题。在我看来，合适的服务器配置应能让我们采用多种方式来处理该问题，而子文件夹只是其中一种。我是否遗漏了什么？

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2020年七月8日 14:54 UTC](https://meta.discourse.org/t/put-discourse-on-a-sub-url/157052/6 "2020-07-08T14:54:41Z")

</div>

官方指南：[Serve Discourse from a subfolder (path prefix) instead of a subdomain](https://meta.discourse.org/t/subfolder-support-with-docker/30507?u=falco)

---

<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: [2020年八月7日 14:54 UTC](https://meta.discourse.org/t/put-discourse-on-a-sub-url/157052/7 "2020-08-07T14:54:55Z")

</div>

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