安装时如何指定不同的端口(非80)?

I am installing this on the production server, which I already have a website running on port 80.

How do I specify a different port to install Discourse?

Currently it won’t let me install and says:

# ./discourse-setup
Port 80 appears to already be in use.

If you are trying to run Discourse simultaneously with another web
server like Apache or nginx, you will need to bind to a different port

See https://meta.discourse.org/t/17247

However the above link says “assumes you already have Discourse working”, but I don’t.

Yes, that does appear to be something of a chicken-and-egg problem… what the discourse-setup script does, more-or-less, is just copy samples/standalone.yml to containers/app.yml and edit a bunch of stuff in response to your answers to a bunch of questions. You can do the same thing yourself – copy the file, edit to suit. It’s how all installs used to be done before @codinghorror decided he wanted to show he could write bash scripts with the best of 'em. :grinning:

Just bear in mind that running on a different port that 80 and 443 isn’t really supported, and there will be some things broken.

If you really need to reuse the server you can set nginx in front to proxy request between discourse and he other site. There’s an howto for that.

Thank you for the answers!

what is it that actually isn’t working when using different ports? did it some months ago for a little test install and can’t see any issues …

now would have to do a more serious installation and am not sure if i should bother doing the nginx-proxy-thing or just change the ports as i did with the other…

tia,
markus.

It breaks some parts, and since isn’t a priority for us (you can just use a reverse-proxy + subdomain or subfolder) we won’t be spending time to add support for this.

well, what are these parts? i still couldn’t uncover any…

and for me at least - on a plesk managed server where it’s a bit harder to see what’s actually happening behind the scenes - this reverse-proxying so far seems over my head… and from what i found so far most plesk related howtos and threads essentially end up using different ports as well… :roll_eyes:

That’s mostly unknown, but when you use a port and find out that it didn’t work, you’ll know. And then you can’t get help here, because it’s not supposed to work.

Your best bet is to install on a separate server.

2020 年是否仍然如此,即 Discourse 不能或不应安装在 80/443 以外的端口?还是这个问题最终已经解决了?

为了解决这样一个简单的问题而安装 nginx 似乎有点大动干戈!大多数软件只需指定其需要绑定的端口即可。而且我在 app.yml 中确实看到了 http/https 端口。

是的,非默认端口仍然是不受支持的生产环境配置。

将其称为“问题”有些言过其实,如今在非标准端口上运行任何服务的理由都很少。现在使用 nginx/traefik 进行反向代理非常简单,而且免费的 SSL 证书也随处可见。

您能否详细说明一下,这究竟为什么是个问题?

因为我试图安装它的那个 K-12 学校服务器限制了可安装的软件以及可绑定的端口。而且该服务器已经在 80、443 和 8080 端口上运行 Apache,以支持学校运行的其他服务。

我无法理解,在当今这个年代,为何一款 Linux 服务器软件不支持在配置文件中定义端口,以便用户更改端口。从我能想到的所有软件来看,从早期的 Telnet 和 FTP 时代,到现代的 SSH、Apache 等,都支持这一功能。

当然,那是因为在过去,在一台主机上配置多个 IP 地址比较困难,而且主机头配置也更加棘手。

现在,你可以为单个 SAN 证书配置一堆域名,并利用反向代理将流量转发到不同的套接字,这一切都是 :money_with_wings:免费 :money_with_wings: 的。

需要在非标准端口上运行应用程序的日子早已一去不复返了。

我获准安装一个单服务器软件包,并开放一个端口用于测试 Discourse。如果告知对方,由于 Discourse 被硬编码为绑定到已被其他团队占用的端口,因此我需要安装其他反向代理软件,并需让校董会层面的其他团队参与,这将导致无法推进。他们绝不会批准此类变更。

那么您唯一的选择就是离线安装,或者寻找其他产品。5美元的VPS将允许您充分测试Discourse。您甚至可能获得免费试用。

或许值得向他们介绍许多项目正在采用的一些趋势。使用Docker等技术和标准端口依赖进行自动化安装现已成为常态。

我们为所有学校提供为期 3 个月、无附加条件的试用服务,详情见 COVID-19 and Discourse

您可以直接利用该链接进行试用。如果最终需要自行托管,也完全没问题,您可以带走自己的数据。

作为一名家长,在新冠疫情时期试图帮助当地一所K-12学校,说服整个校董会改变其IT基础设施的运作方式……这几乎是不可能的。

至于教育人们采用当前流行的技术趋势,我建议提供一个受支持的“端口”选项,就像其他所有Linux服务器软件那样,这样人们就可以轻松更改TCP端口,而无需额外安装反向代理。

谢谢你提供的新冠疫情链接,萨姆。我会告知他们。我想象不到他们还会允许我对他们的服务器做任何进一步的修改,所以希望他们会走那条路。

我以前是大学教授,经常尝试做这样的事,所以我明白你在说什么。最简单的解决方案是进行外部托管。希望他们有足够的带宽,并且没有规定要求数据必须存储在校园内。

如果你希望自行托管,而不是使用 cdck 提供的托管服务,我可以免费在 DigitalOcean 上为你安装并配置 Mailgun。除非技术团队愿意为你创建大量 DNS 记录,否则注册自己的域名可能会更容易。

感谢你的提议。

我想我们错过了完成此事的时机。校长已经砍掉了这个项目,称解决方案需要由校董会提供,而我无法在服务器上安装这个。虽然值得一试,但看来校董会正在调查使用 Microsoft Teams 作为解决方案。