端口 80 何时可用?

我对基于 Docker 新安装 Discourse 时何时暴露 80 端口感到有些困惑。让我解释一下……

当我运行 ./discourse-setup 时,我假设初始问题(主机名、电子邮件地址等)都是在容器创建之前提出的,因此也是在 Discourse 暴露 80 端口之前提出的。这是正确的吗?

如果是这样,那么在输入主机名时,这是否会造成一点“进退两难”的局面?

我已经创建了我的 A 记录(并且可以通过主机名 ping 通)。但 80 端口并未开放。我认为我明白原因,即容器尚未创建。

但如果情况确实如此,那么如果主机名验证是在容器创建之前进行的,那最初的验证如何能成功呢?

显然我在这里有一个错误的假设,所以有人能帮我解开这个谜团吗?

谢谢。

1 个赞

discourse-setup runs nc which opens the port for the test.

If you are running an OS that does not have nc installed that test will fail because of that. You can either confirm whether a missing nc is the problem or just assume that you know what you’re doing and it’ll just work.

3 个赞

Ah, got it.

Assuming I know what I am doing has generally been proven to be a poor choice! But I’m ignoring the warning now and ploughing on.

I’m suspect I am still going to come across an issue, since I assume nc should allow port 80 to be exposed (I have no firewall yet) but I will deal with that later.

Thank you again.

2 个赞

Well, that’s why it does those tests. But they only work for most people most of the time.

If you type nc at the command line and you get a command not found then you can assume that the test is broken (which doesn’t mean that your domain name resolves to your server and that the port is accessible).

2 个赞

I had this issue when I set up my first server and, irritatingly, the issue resolved itself after a few hours. That sort of issue often hints at a DNS replication issue, but I am using CloudFlare DNS (low TTL) and I can ping, through the host name, just fine.

The docker installation completed OK and nc is available.

docker ps suggests that both ports 80 and 443 are directed to the container.

sof -i -P -n reports that docker-pr is listening to both ports too.

I never figured out why this problem occurred with the first installation, but now it’s happened again I will drill down and troubleshoot. Haven’t figured it out yet but suspect it’s some basic plumbing.

Thanks again.

1 个赞

Sounds like a DNS propagation issue.

Is the orange cloud on? If cloudflare is DNS only, you’re fine, but if it’s in the middle you won’t be able to make Let’s Encrypt work, which is the point of the test.

3 个赞

The Orange Cloud is off. I don’t want to bother you further with this, Jay. This is an interesting little troubleshooting challenge and I will figure it out.

Pretty certain it’s not DNS replication since I can access the site from numerous devices by host name (through WiFi, cellular, etc). I will report back here if/when this is resolved.

2 个赞