# 使用CloudPanel管理多个Discourse站点

**URL:** https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427
**Category:** Self-hosting
**Created:** [2023年五月18日 05:58 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427 "2023-05-18T05:58:07Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [2023年五月18日 05:58 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/1 "2023-05-18T05:58:07Z")

</div>

您可以直接在此处访问我的分步教程……

> [@Install Discourse on CloudPanel](https://meta.discourse.org/t/install-discourse-on-cloudpanel/266422):
>
> warning This installation method is not officially endorsed. Use at your own risk. The Discourse team only recommend installation using the [official install guide](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md)information_source This is an unsupported install, appropriate for those who have experience with CloudPanel, are experienced system administrators, and comfortable with docker, reverse proxies, and have successfully completed a standard installation. Why CloudPanel Why might you want to install a Discourse Forum on a VPS o…

在我（Hetzner）的专用服务器上，我安装了一个全新的 Discourse 实例（这是当时服务器上唯一的东西）。

现在我想使用 [CloudPanel](https://www.cloudpanel.io/) 作为反向代理，这样我也可以使用该服务器为我的某些客户托管 Ghost 博客和 Wordpress 网站。

通过阅读[本教程](https://www.wpdoze.com/cloudpanel-as-a-reverse-proxy-for-docker/)，以及研究下面的其他帖子，这似乎是可能的。

但我正在努力学习反向代理的知识。

我可以轻松地使用 CloudPanel 安装和管理我的网站。

但是，我不清楚如何正确地操作才能让 CloudPanel 与 Discourse 协同工作。

我想在此帖中记录下这个过程。

有人能指导我完成这个过程吗？

> **[Setup CloudPanel As Reverse Proxy with Docker and Dockge](https://www.bitdoze.com/cloudpanel-setup-dockge/)**
>
> Use CloudPanel as a reverse proxy with Dockge for managing your Docker containers.

> [@Run other websites on the same machine as Discourse](https://meta.discourse.org/t/run-other-websites-on-the-same-machine-as-discourse/17247):
>
> @pfaffman edited this heavily 2022.02.24. Blame me if it’s broken. If you want to run other websites on the same machine as Discourse, you need to set up an extra NGINX or HAProxy proxy in front of the Docker container. NOTE: This is for advanced admins This guide assumes you already have Discourse working - if you don’t, it may be hard to tell whether or not the configuration is working. You cannot use ./discourse-setup to set up Discourse if another server is using port 80 or 443. You will …

> [@Use Nginx Proxy Manager to manage multiple sites with Discourse](https://meta.discourse.org/t/use-nginx-proxy-manager-to-manage-multiple-sites-with-discourse/206344):
>
> EDIT: @pfaffman re-wrote this as a standalone topic from what @tophee had written earlier. It’s not yet tested by me, and I’ve moved around Chris’s words, so any mistakes are likely those of @pfaffman. Are there any reasons not to use [NGINX Proxy Manager](https://nginxproxymanager.com/) instead of doing this manually as described in [Run other websites on the same machine as Discourse](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247)? I’m already using it. I’ve had it on my home server for a while and when I migrated my discourse instance to a new cloud server, I realized t…

> **[Run Multi-Sites on the Same Server as Discourse](https://henrywithu.com/run-multi-sites-on-the-same-server-as-discourse/)**
>
> 0. Before you proceed
> 
> 
> This article assumes that you installed Discourse via the Official Simple 30 Minute Basic Install on GitHub
> 
> If you want to run other websites on the same machine as Discourse, you need to set up an extra NGINX or HAProxy...

---

<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: [2023年五月18日 07:44 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/2 "2023-05-18T07:44:24Z")

</div>

首先，请按照以下指南之一将 Discourse 移动到另一个端口，并删除 SSL 和 Let’s Encrypt 模板，然后重建。之后，请将您的反向代理指向该端口。

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [2023年五月18日 08:15 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/3 "2023-05-18T08:15:59Z")

</div>

如果我先安装 CloudPanel，然后在界面中创建反向代理……

 ![cloudpanel-app-selector](https://global.discourse-cdn.com/meta/original/4X/1/3/b/13b9e1ca45ea458f508ab680462c77c6c84df676.jpeg)  
 ![cloudpanel-reverse-proxy-settings](https://global.discourse-cdn.com/meta/original/4X/7/1/5/715c47a80e516bc96e4207bdd542b99ca7930b17.png)

……以及/或者在 Vhost 编辑器中……

 ![cloudpanel-vhost-editor](https://global.discourse-cdn.com/meta/original/4X/2/4/2/242e6ba7e94e2c439991357867e9aa4357608da2.jpeg)

> **[CloudPanel 2.2.1 Release: Reverse Proxy Support and New Languages](https://www.cloudpanel.io/blog/cloudpanel-2-2-1-release-reverse-proxy-support-and-new-languages/)**
>
> CloudPanel 2.2.1 brings new languages and Reverse Proxy support. Get enhanced security and performance with latest CloudPanel release!

……然后我能安装 Discourse 吗？

或者，有必要或以某种方式更可取的是先安装 Discourse？

我想为其他像我一样简单的用户提供最简单/最直观的方法的步骤 🙂

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [2023年五月18日 10:30 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/4 "2023-05-18T10:30:56Z")

</div>

没关系。只要

- Discourse 不使用 80/443 端口，因为冲突会使您的反向代理崩溃
- Discourse 不使用 SSL，但将 80 端口暴露给反向代理使用的后端端口

所以 _没关系_ 的意思是 Discourse 必须在您启动反向代理之前设置为后端，并且在那时是无法访问的。

---

<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: [2023年五月18日 11:06 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/5 "2023-05-18T11:06:27Z")

</div>

> [@denvergeeks](#):
>
> 我想提供最简单/最直观的方法（对我这样的其他简单的人来说 🙂 ）的步骤

这不是为简单的人准备的。您必须同时了解反向代理的工作原理以及如何手动配置 discourse。这并不简单，也不直观。

对于新手来说，支持标准安装已经足够困难了。已经花费了大量时间来使这些说明对那些对系统管理一无所知的人员有效。

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [2023年五月18日 19:47 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/6 "2023-05-18T19:47:06Z")

</div>

“花了很长时间才让那些对系统管理一无所知的人也能按照说明操作。”

@pfaffman 我希望将来能为您节省这些时间！

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [2023年五月19日 01:51 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/7 "2023-05-19T01:51:49Z")

</div>

containers/app.yml 是安装程序创建的文件吗？（我在[仓库](https://github.com/discourse/discourse_docker)中找不到它。）

我已经编辑了 standalone.yml 文件并将其重命名为 app.yml

如果我将该文件放入 containers/ 然后运行 ./discourse-setup，是否应该可行？

（假设我已经正确配置了 app.yml 中的设置）

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [2023年五月19日 02:02 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/8 "2023-05-19T02:02:53Z")

</div>

是的。

作为 Discourse 的新手，正确的方法如下：

- 暂时禁用您的反向代理。
- 在禁用 SSL/Let’s Encrypt 的情况下安装 Discourse
- 在 :80 上验证安装是否正常工作
- 将 Discourse 端口更改为 81 或其他非标准端口，或者最好使用套接字。
- 重新启动反向代理，配置针对 Discourse 安装（包括 https 封装）
- 启用 force\_https

如果您不在反向代理的情况下安装 Discourse，那么可能出错的地方太多，难以进行实际故障排除。

---

<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: [2023年五月19日 10:04 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/9 "2023-05-19T10:04:52Z")

</div>

您不能使用 discourse-setup 进行设置。如果已编辑，请运行

`./launcher rebuild app`

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [2023年五月19日 14:28 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/10 "2023-05-19T14:28:32Z")

</div>

奇迹中的奇迹——我们成功了！感谢您的所有帮助！我将在上面的主题帖中记录该过程。

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [2023年五月19日 23:21 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/11 "2023-05-19T23:21:39Z")

</div>

好的，我卡在一个（我认为是小）问题上……

要创建第二个 Discourse 实例，我需要创建并编辑第二个 Discourse 的 _app2.yml_ 和 _server\_name.conf_，更改 DISCOURSE\_HOSTNAME 和 server\_name。

但是……然后我该如何构建 app2 呢？我尝试了：

`service nginx restart`

`./launcher stop app`

`./launcher rebuild app2`

以及

./discourse-setup （我安装第一个实例时使用了 ./discourse setup，然后回去编辑了 app.yml，这在第一个实例上是有效的。）

这个过程确实得到了第二个域名的 Discourse，但它似乎正在从第一个实例获取数据。

我有些不明白。构建第二个域名的第二个站点的正确方法是什么？

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [2023年五月20日 03:05 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/12 "2023-05-20T03:05:51Z")

</div>

您的反向代理是否配置为监听第二个域并将流量路由到不同的端口？

---

<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: [2023年五月20日 10:18 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/13 "2023-05-20T10:18:41Z")

</div>

> [@denvergeeks](#):
>
> 此过程确实在第二个 URL 中产生了 Discourse，但它似乎正在从第一个实例获取数据。

您需要更改它所说的 `/var/discourse/standalone` 的目录，将其更改为其他内容（例如 `standalone2`？）。  
您可能想使用双容器设置，这样您就只运行一个 postgres 实例（我认为 [使用 Docker 进行多站点配置](https://meta.discourse.org/t/multisite-configuration-with-docker/14084) 中有一些提示），但如果您有大量内存，您可能不在乎。

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [2023年五月20日 16:05 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/14 "2023-05-20T16:05:56Z")

</div>

哇。我一个人永远也弄不明白。你是我今天的英雄。

我在这里为（一位客户）构建一个通用的 Discourse 发布系统原型，面向创作者类型，集成 Ghost 和 Discourse。

我是一名前端开发人员，现在需要全面学习系统管理。

所以我需要同时构建多站点和独立容器。

这是我的服务器设置：

1. Hetzner 上的专用服务器（6 个 CPU 核心，64 GB RAM 和 2x512GB NVMe）

2. Contabo 上的 VPS（8 个 CPU 核心，30 GB RAM 和 200 GB NVMe）

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [2023年五月23日 04:26 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/15 "2023-05-23T04:26:28Z")

</div>

> [@Install Discourse on CloudPanel](https://meta.discourse.org/t/install-discourse-on-cloudpanel/266422):
>
> warning This installation method is not officially endorsed. Use at your own risk. The Discourse team only recommend installation using the [official install guide](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md)information_source This is an unsupported install, appropriate for those who have experience with CloudPanel, are experienced system administrators, and comfortable with docker, reverse proxies, and have successfully completed a standard installation. Why CloudPanel Why might you want to install a Discourse Forum on a VPS o…

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年五月23日 07:42 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/16 "2023-05-23T07:42:06Z")

</div>

我对此一无所知，但如果觉得你们的教程可靠，请随意创建一个新的 #documentation:sysadmin #how-to #advanced-setup 以及任何你们认为合适的标签 🙂  
（在你们的答案在一个月后被自动删除之前 😛 ）

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [2023年五月27日 11:10 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/17 "2023-05-27T11:10:05Z")

</div>

好的，是的。因此，对于第二个实例，它起作用了（在 CloudPanel 中创建了一个新的站点后）：

1. 手动创建并编辑 app2.yml，将该文件中每个 **standalone** 的实例更改为 **standalone2**

2. 同样将 **standalone** 更改为 **standalone2** 在 Vhost 文件中

3. 运行 `./launcher rebuild app2`

我想我还清除了所有 Cloudflare 缓存，重启了 nginx，然后还重启了服务器。

再次感谢您的帮助。

---

<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: [2023年六月26日 11:10 UTC](https://meta.discourse.org/t/use-cloudpanel-to-manage-multiple-sites-with-discourse/265427/18 "2023-06-26T11:10:35Z")

</div>

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