自定义nginx时出现SSL错误:证书在所有浏览器中不受信任

我修改了一些设置,以便在同一台 Discourse 服务器上承载其他工作。

某些浏览器在访问网站时会显示 SSL 通知(白屏):

文件: /var/discourse/containers/app.yml

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## 如果您想添加 Let's Encrypt (https),请取消注释以下两行
  # - "templates/web.ssl.template.yml"
  # - "templates/web.letsencrypt.ssl.template.yml"
  - "templates/web.socketed.template.yml"

自动 SSL 生成功能不会像上述那样在更改时运行,因此我手动执行如下操作:

cd /var/discourse
./launcher enter app
"/shared/letsencrypt"/acme.sh --cron --home "/shared/letsencrypt" --force
exit

然后执行 systemctl restart nginx

这是我的 nginx 配置:

server {
    listen 443 ssl http2;

    ssl on;

    ssl_certificate         /var/discourse/shared/standalone/letsencrypt/thuvienmuasam.com/thuvienmuasam.com.cer;
    ssl_certificate_key     /var/discourse/shared/standalone/letsencrypt/thuvienmuasam.com/thuvienmuasam.com.key;

上次没问题,但这次出现了上述错误。

请告诉我,我这样做对吗?

我知道这个问题大约是在 6 个月前提出的。因此,如果您仍在寻找解决方案,不妨尝试以下方法:

  • 复制 ca-bundle 内容(证书),并将其粘贴到您的域名证书之后,放在证书 (CRT) 字段中。

是的,这意味着您的 CRT 字段中会有两个证书(域名证书和 ca-bundle 证书),示例如下:

证书 (CRT)

-----BEGIN CERTIFICATE-----

(域名证书)

-----END CERTIFICATE-----

-----BEGIN CERTIFICATE-----

(ca-bundle 证书)

-----END CERTIFICATE-----

文件路径:/var/discourse/shared/standalone/letsencrypt/thuvienmuasam.com

如果此方法有效,那只是说明您的托管提供商安装证书的方式如此。

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.