Unable To Connect/Connection Refused due to https certificates

We successfully installed Discourse through DigitalOcean using the following guide:

discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub

Our DNS is fully propagated, and we also installed our SSL CERTS per the following guide:

When browsing to our Discourse installation via IP or domain name, we get the following message:

This site can’t be reached

XX.XX.XX.XX refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED

What could be the problem?

Almost certainly a SSL problem. Try rebuilding with plain HTTP first to make sure everything is working before adding on the complexity of HTTPS.

Using let’s encrypt is an easy way to get ssl.

… thanks for your help.

I am running into this same issue, To rebuild with plain HTTP, does that require just commenting out the SSL template line in app.yml?

Yes, but browsers that have visited your site will refuse to connect. You really should use https.

4 个赞

For anyone that face it in the future, make sure to not exceed the rate limit of LetsEncrypt:

You can see if it was exceeded in the logs:

./launcher logs app

2 个赞

我在 Chrome 上遇到了完全相同的提示。

就我的情况而言,有几处配置设置错误:有些是 Discourse 的设置,有些是托管服务器的配置。我将我的检查清单贴在这里供你参考:

  1. 检查 /var/discourse/containers/app.yml

(参考此帖子:https://meta.discourse.org/t/advanced-setup-only-allowing-ssl-https-for-your-discourse-docker-setup/13847)

确保你要么允许 HTTPS/HTTP(开放 443 端口,取消注释与 SSL 相关的模板配置以及 Let’s Encrypt 相关配置),要么仅允许 HTTP 请求(禁止 443 端口,注释掉与 SSL 相关的模板配置以及 Let’s Encrypt 相关配置)。

如果对 app.yml 进行了任何更改,请运行 ./launcher rebuild app 以激活更新后的配置。

  1. 运行 ./launcher logs app

如果你像我一样频繁无法成功重建一个功能正常的 Discourse 服务器,可能同时请求了过多的 Let’s Encrypt 凭证并超出了其限制。

此时运行 ./launcher logs app 会打印出一个包含 429 错误的 json 响应。

  1. 检查你的 ECS 服务器实例的“安全组”设置

在我的案例中,“安全组”本质上是一组已授权开放的端口(例如 80 HTTP、443 HTTPS),用于控制你的服务器与外部网络之间的通信。

请确保开放托管 Discourse 所需的端口。

  1. 检查防火墙设置

在我的案例中,第 3 步并未为我开放所需端口,问题出在我的防火墙设置上。

奇怪的是,我从未为服务器配置过防火墙,但在执行以下配置后,这些端口确实被开放了:
apt install firewall-cmd
firewall-cmd --permanent --add-port=20-21/tcp(…以及其他端口)
firewall-cmd --reload

你可以使用一些在线服务检查你的域名已开放端口的状态。

2 个赞

我也遇到了这个问题——证书请求超过了速率限制。

按照你的第 1 步操作(在 app.yml 中注释掉两个 SSL 模板)并重新构建后,用另一个浏览器打开网站,问题就解决了。

我预计一周后应该就能重新启用 SSL。

2 个赞

一周过去了,您成功连接上了吗?

1 个赞