nginx使用socket代理discourse, 而不是使用端口代理, 优势在于:
- 提高安全和性能, 少一次 TCP stack
- discourse官方推荐
- 不暴露无谓端口
- UNIX socket 比本地网络通信(比如 localhost:3000)效率更高,省略网络协议栈
Discourse
如果是已部署的修改, 需要重建app /var/discourse/launcher rebuild app
app.yml
templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  ## Uncomment the next line to enable the IPv6 listener
  #- "templates/web.ipv6.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/cloudflare.template.yml"
  - "templates/web.socketed.template.yml"
  ## Uncomment these two lines if you wish to add Lets Encrypt (https)
  #- "templates/web.ssl.template.yml"
  #- "templates/web.letsencrypt.ssl.template.yml"
## 此容器应暴露哪些 TCP/IP 端口?
## 如果您希望 Discourse 与另一个 Web 服务器(如 Apache 或 nginx)共享端口,
## 请参阅 https://meta.discourse.org/t/17247 获取详细信息
expose:
  #- "2080:80"   # http
  #- "2443:443" # https
~~~~~~
1panel
需要修改openresty的compose.yml
 - /var/discourse:/var/discourse

openresty
unix:/var/discourse/shared/standalone/nginx.http.sock:

成果
不再是cloudflare的IP地址了
不过好像发现用户头像图片加载有点问题, 不太确定, 再看看

评论区