Discourse 如何更改默认端口
本菜鸡之前自己也建了一个 Discourse 论坛,但是由于 Discourse 本身官网要求强制 Docker 部署,而且容器内部自带 Nginx,而且绑定了 80 和 443 端口,导致如果我想要在同一台机器上部署其他网站或者同时运行
恰好在论坛看见站长 @anonymous_coward_old 发的技术细节,于是本菜鸡很好奇这个方法是如何实现的:

ぜーんぶ弾けなーい!
其实就是想知道反代是怎么实现的啦~
困扰挺久的其实 😇
ぜーんぶ弾けなーい!
你 ping 的那个账号是公用的匿名账号
@anonymous_coward
https://meta.discourse.org/t/run-other-websites-on-the-same-machine-as-discourse/17247
Change the container definition
This is where we change how Discourse actually gets set up. We don’t want the container listening on ports - instead, we’ll tell it to listen on a special file.
You need to edit /var/discourse/containers/app.yml to disable ssl and add template to create nginx sock. It should look like this:
# base templates used; can cut down to include less functionality per container templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
# - "templates/web.ssl.template.yml" # remove - https will be handled by outer nginx
# - "templates/web.letsencrypt.ssl.template.yml" # remove -- https will be handled by outer nginx
- "templates/web.ratelimited.template.yml"
- "templates/web.socketed.template.yml" # <-- Added
Be sure to remove or comment out the exposed ports by putting a # in front.
# which ports to expose?
# expose: comment out entire section by putting a # in front of each line
# - "80:80" # http
# - "443:443" # https
Now you can
/var/discourse/launcher rebuild app
to rebuild Discourse to make its data available to the socket.
容器里头的 nginx 监听在 unix socket,共享到容器外,用你喜欢的反代代理即可,如 caddy:
reverse_proxy unix//var/discourse/shared/app/nginx.http.sock
IO 谢谢佬 by the way 想知道你服务器是哪里买的
ぜーんぶ弾けなーい!
Soyo34325 这个全方位好,除了 CN net
https://www.netcup.eu/bestellen/produkt.php?produkt=3963
€13.68/m 8C16G+512G, unlimited BW, dedicated CPU
这个香港的有时候网络好
https://hosthatch.com/
$15/m 4C16G(1 dedicated CPU+3 shared CPU), ~4T BW
IO 感谢分享 我用了某杂牌(狗云) 🫠
有机会换过来
ぜーんぶ弾けなーい!
Soyo34325 杂牌厂不能用(尤其是国人商家、one man)
Hetzner Netcup(Anexia) Vultr DO Linode AWS/Lightsail Oracle(如果你的信用卡能注册的上) Azure/GCP(如果你有钱) 正规大厂随便用(这些我都用过)
IO 我原先用的是 Digital Ocean 学生包里面的
但是后来考虑到需要长期维护 学生包的钱只能用一年所以想迁移
现在既然这样考虑去办一张 visa 卡了
其实我昨天买了雨云的香港 CN2 优化机器 但是被恶心了(封了 587 端口 邮箱服务器没法用
ぜーんぶ弾けなーい!
Soyo34325 如果业务不重要可以。不靠谱的反代机器会:
- 降低 uptime
- 有数据泄露的风险(man in the middle)
IO 感谢提醒,不过我还想再问一下人在国内你的支付方法是什么:
- 信用卡
- palpay
大学生怎么办卡 🫠
ぜーんぶ弾けなーい!
Soyo34325 去 BOC 陕西省分行办理“长城跨境通”借记卡(debit card)(Mastercard)
IO All right. Thanks a lot.
ぜーんぶ弾けなーい!
Soyo34325 不要用国内的外币借记卡,要不停手动购汇,很麻烦,而且外汇管制很恼人
建议是:有条件就去香港开个户,拿 hsbc 的 master card 扣张卡
没条件可以去广发银行办一个 American Express Lucky 借记卡,这张卡是人民币卡,所有境内外交易(对在大陆也可以用)全部以人民币记账。而且如果你在广发没有其他卡的话,本卡可开一类账户。
uika_winwing 确实有想去香港开一张卡的想法 国内的各种外汇卡让我很迷 🫠
不知道香港开卡有没有什么要求 准备明年寒假去一趟香港 顺便办一张电话卡
ぜーんぶ弾けなーい!
uika_winwing 对了老哥,借记卡、信用卡、储蓄卡这三种卡有啥关系和区别吗
ぜーんぶ弾けなーい!
Soyo34325 为什么是 老哥 🥺😢 紫砂了 ![]()
uika_winwing 小哥哥 小姐姐 🥹
教教小弟弟 好么 😖
ぜーんぶ弾けなーい!
IO 🚪友 想問問本站的簽名或者説小尾巴是什麼插件或者主題組件 很喜歡
ぜーんぶ弾けなーい!