nodejs greenlock-express 不会创建证书

问题描述 投票:0回答:2

我正在尝试简单的 greenlock-express 示例,我已经尝试了很多次,但它不起作用。我按照教程做了很多次。我创建了

greenlock.d/config.json
文件并且它可以工作,因为我在输出中看到了域。

当我启动时,我看到:

webhook_test | Listening on 0.0.0.0:80 for ACME challenges, and redirecting to HTTPS
webhook_test | Listening on 0.0.0.0:443 for secure traffic
webhook_test | Ready to Serve:
webhook_test |   ewkhrwk.xyz

但是当我用邮递员访问它时,我得到了

webhook_test | ACME Directory URL: https://acme-v02.api.letsencrypt.org/directory
webhook_test | 
webhook_test | By using this software you ([email protected]) are agreeing to the following:
webhook_test | ACME Subscriber Agreement: https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
webhook_test | Greenlock/ACME.js Terms of Use: https://rootprojects.org/legal/#terms
webhook_test | 

这样的状态持续了几分钟。以前,当我几个月前使用 greenlock 时,它只会在第一次访问时生成证书。

几分钟后我明白了

webhook_test | Error cert_issue:
webhook_test | connect ETIMEDOUT 165.232.74.82:80
webhook_test | code: ETIMEDOUT
webhook_test | Error: connect ETIMEDOUT 165.232.74.82:80
webhook_test |     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
webhook_test | Error cert_issue:
webhook_test | connect ETIMEDOUT 165.232.74.82:80
webhook_test | code: ETIMEDOUT
webhook_test | Error: connect ETIMEDOUT 165.232.74.82:80
webhook_test |     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
webhook_test | Error cert_issue:
webhook_test | connect ETIMEDOUT 165.232.74.82:80
webhook_test | code: ETIMEDOUT
webhook_test | Error: connect ETIMEDOUT 165.232.74.82:80
webhook_test |     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
webhook_test | set greenlockOptions.notify to override the default logger
node.js express lets-encrypt certbot greenlock
2个回答
0
投票

在尝试设置使用 greenlock 的项目时,我遇到了完全相同的错误。发生这种情况是因为 greenlock 尝试从设置证书的计算机访问 http://example.com

从互联网访问 http://example.com 将得到如下所示的回复

curl -i http://example.com
HTTP/1.1 301 Moved Permanently
Location: https://example.com/
Content-Type: text/html; charset=utf-8
Date: Thu, 14 Jul 2022 13:39:01 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 215
[...]

但是,当我尝试从我尝试使用 greenlock 设置证书的计算机访问 http://example.com 时,请求超时。发生这种情况的原因是网络问题,从内部网络访问 example.com 实际上无法正常工作。我的修复方法是在 /etc/hosts 中添加“127.0.0.1 example.com”,以便将 example.com 解析为本地主机。


0
投票

2024,greenlock-express v4:

this 演练中,它指定了一个新的 greenlock.defaults 属性“agreeToTerms”,该属性必须设置为 true。这可能就是您收到“协议”错误消息的原因。

© www.soinside.com 2019 - 2024. All rights reserved.