certbot 无法验证域和连接被拒绝

kse*_*now 8 lets-encrypt certbot

我正在尝试为我的域生成证书。我可以 ping 我的域,但仍然出错。我已将入站防火墙规则添加到我的数字海洋服务器以接受 ipv4 和 ipv6 上的端口 80。不知道出了什么问题。[注意:我的 nginx 服务器没有运行,因为我无法获得证书]

https://community.letsencrypt.org/t/invalid-response-404-nginx-docker-container/102525

我的域名是:www.1040nra.com

我运行了这个命令:sudo certbot certonly --staging --webroot -w /root/dt-app-data/ -d 1040nra.com -d www.1040nra.com

它产生了这个输出:

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for 1040nra.com
http-01 challenge for www.1040nra.com
Using the webroot path /root/dt-app-data for all unmatched domains.
Waiting for verification…
Cleaning up challenges
Failed authorization procedure. 1040nra.com (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://1040nra.com/.well-known/acme-challenge/22AD-KFmF62z373CPiUKzk6dlr-0s5wMOmnmrziMqd4: Connection refused, www.1040nra.com (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://www.1040nra.com/.well-known/acme-challenge/ba-jjDhBUZJ9fHLofGfDYSVV5a-ETlX26A64A-2Yu0s: Connection refused

IMPORTANT NOTES:

The following errors were reported by the server:

Domain: 1040nra.com
Type: connection
Detail: Fetching
http://1040nra.com/.well-known/acme-challenge/22AD-KFmF62z373CPiUKzk6dlr-0s5wMOmnmrziMqd4:
Connection refused

Domain: www.1040nra.com
Type: connection
Detail: Fetching
http://www.1040nra.com/.well-known/acme-challenge/ba-jjDhBUZJ9fHLofGfDYSVV5a-ETlX26A64A-2Yu0s:
Connection refused

To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA 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.
My web server is (include version):
Run Code Online (Sandbox Code Playgroud)

我的网络服务器运行的操作系统是(包括版本):ubuntu 18.04

小智 8

通过运行以下命令确保端口80和已打开:443

sudo ufw status
Run Code Online (Sandbox Code Playgroud)

如果端口443未打开,则运行以下命令以允许端口443

sudo ufw allow https
Run Code Online (Sandbox Code Playgroud)


小智 7

看来你自己已经解决了这个问题。

这是因为 certbot 域无法验证 DNS A 记录。

确保您的域名地址定向到您的服务器的 IP 地址。

如果您“最近”更改了 dns,则可能需要一些时间才能删除旧的 IP 地址。

https://www.whatsmydns.net/

检查这里,应该只有一个IP地址,并且这应该是你的服务器的IP地址。