【发布时间】:2017-06-08 17:50:20
【问题描述】:
我使用 certbot 为我的网站生成了一个 Let's encrypt 证书,但是当我尝试连接它时 Yaws 给了我一个 SSL accept failed: timeout 错误(当然是在超时之后)。有趣的是,当我将 example.com 重定向到我机器上的 hosts 文件中的服务器的本地 IP 地址并连接到 example.com:8080 时,它可以工作,但当我在不编辑主机文件的情况下连接到 example.com 或从我的手机超过4G。这是我的网络服务器的配置文件(它是conf.d中唯一的配置文件):
<server www.example.com>
port = 8080
listen = 0.0.0.0
docroot = /usr/share/yaws
<ssl>
keyfile = /etc/letsencrypt/live/example.com/privkey.pem
certfile = /etc/letsencrypt/live/example.com/fullchain.pem
</ssl>
</server>
我确保 yaws 用户可以读取密钥文件和证书。密钥文件旁边是 README,其中包含以下内容:
`privkey.pem` : the private key for your certificate.
`fullchain.pem`: the certificate file used in most server software.
`chain.pem` : used for OCSP stapling in Nginx >=1.3.7.
`cert.pem` : will break many server configurations, and should not be used
without reading further documentation (see link below).
We recommend not moving these files. For more information, see the Certbot
User Guide at https://certbot.eff.org/docs/using.html#where-are-my-certificates.
所以我比较确定我使用了正确的文件(其他文件给了我错误,例如 badmatch 和 {tls_alert,"decrypt error"})。我还尝试了一些琐碎的事情,比如在 URL 之前写 https://,但它没有解决问题,而且,当服务器在没有 SSL 的情况下运行时一切正常。我的服务器上运行的 Erlang 版本是 Erlang/OTP 19。另外,如果不清楚,域实际上不是 example.com。
另外,example.com 会通过 cname 重定向到 examplecom.duckdns.org,如果这很重要的话。
更新:
我的服务器正在侦听端口 8080,该端口是从外部端口 80 转发的,用于 https 连接,而默认 https 端口是端口 443。我的另一个错误是连接到http://example.com 而不是https://example.com。将外部端口 443 转发到内部端口 8443 并将 yaws 配置为侦听端口 8443 修复了所有问题。
【问题讨论】: