# 当反向代理和 Discourse 位于不同计算机时的配置帮助

**URL:** https://meta.discourse.org/t/config-help-when-reverse-proxy-and-discourse-on-seperate-computers/403720
**Category:** Self-hosting
**Tags:** nginx
**Created:** [2026年五月24日 15:15 UTC](https://meta.discourse.org/t/config-help-when-reverse-proxy-and-discourse-on-seperate-computers/403720 "2026-05-24T15:15:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![selfaware](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@selfaware](https://meta.discourse.org/u/selfaware)
#### Post date: [2026年五月24日 15:15 UTC](https://meta.discourse.org/t/config-help-when-reverse-proxy-and-discourse-on-seperate-computers/403720/1 "2026-05-24T15:15:00Z")

</div>

你好，

系统：Ubuntu 24.04  
Nginx

我目前有一个功能完整的 Discourse 服务器运行在 [forum.example.com](http://forum.example.com)（例如 IP 为 192.168.0.2），同时还有一个反向代理服务器托管静态首页 [example.com](http://example.com)（例如 IP 为 192.168.0.1）。

由于托管 [example.com](http://example.com)（index.html）的反向代理服务器与托管 [forum.example.com](http://forum.example.com) 的 Discourse 服务器位于两台不同的本地计算机上，我有一些关于反向代理服务器块配置以及 Discourse 服务器 app.yml 设置的问题。

问题 1：

我假设以下配置：  
proxy\_pass [http://unix](http://unix):/var/discourse/shared/standalone/nginx.http.sock;

应该改为：  
proxy\_pass [http://192.168.0.2](http://192.168.0.2)

如果是这样，我是否还需要指定端口？

例如：  
proxy\_pass [http://192.168.0.2:80](http://192.168.0.2:80)

如果需要指定端口，应该使用哪个端口？这又该如何反映在 Discourse 的 app.yml 文件中，特别是关于以下内容：

#expose:

# - “80:80” # http

# - “443:443” # https

我了解 Discourse 知识库中关于在反向代理上部署 Discourse 的指南，但那些指南均假设反向代理和 Discourse 位于同一台计算机上。除了 AI 生成的结果外，我未能找到关于反向代理与 Discourse 实例分别部署在两台不同计算机时配置差异的相关信息。

谢谢。
