我在为两个不同服务器上设置的几个网站设置 Let's Encrypt 时遇到一些问题,并通过 HAProxy 将流量分配给它们。
服务器上有许多虚拟主机/域,所有这些都需要 SSL 证书。为了这篇文章,假设他们是:
- foo.some-site.com
- bar.some-site.com
这两个 A 记录都设置了两个 IP 地址。我可以使用 nwtools.com 或仅 nslookup 验证 A 记录foo.some-site.com和bar.some-site.com解析相同的两个 IP 地址。而且我知道 Let's Encrypt 要求虚拟主机使用有效记录,以便它可以进行查找。
我计划在两台服务器上为所有虚拟主机运行 Lets Encrypt 设置,其中一台运行良好,但是当我转到第二台时,出现错误:
[root@server httpd]# /opt/letsencrypt/letsencrypt-auto --apache -d foo.some-site.com
Checking for new version...
Requesting root privileges to run letsencrypt...
/root/.local/share/letsencrypt/bin/letsencrypt --apache -d foo.some-site.com
Failed authorization procedure. foo.some-site.com (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Failed to connect to host for DVSNI challenge
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: foo.some-site.com
Type: connection
Detail: Failed to connect to host for DVSNI challenge
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A record(s) for that domain
contain(s) the right IP address. Additionally, please check that
your computer has a publicly routable IP address and that no
firewalls are preventing the server from communicating with the
client. If you're using the webroot plugin, you should also verify
that you are serving files from the webroot path you provided.
这可能是因为它正在查找或尝试 curl foo.some-site.com,并且它可能被定向到另一台服务器?我不确定这有多重要,因为两者都有相同的 VHost,除非 LetsEncrypt 实际上正在监听它自己建立的连接......
让我失望的是它适用于其中一个很好(比如bar.some-site.com),那么为什么它适用于一个站点,但对于另一个具有完全相同设置的站点却失败了?
如果有人知道如何在两台不同的服务器上为相同的虚拟主机设置 Lets Encrypt,我们将不胜感激!