无法使用 nginx (certbot) 将 Let's encrypt ssl 证书添加到域

Unable to add Let's encrypt ssl certificate to domains using nginx (certbot)

我在使用 nginx 和 certbot 将 Let's Encrypt SSL 证书应用到我的域时遇到问题。我的 (Nuxtjs) 网站 运行 在 VPS 上 Ubuntu 18.04。我想将证书添加到 mydomain.nl 和暂存。mydomain.nl 但我做不到。我对此很陌生,但我之前确实成功地做到了这一点。

如果我是正确的,certbot 会在 运行 sudo certbot --nginx 时尝试放置一个文件来验证域。但随后出现以下错误:

Failed authorization procedure. mydomain.nl (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://mydomain.nl/.well-known/acme-challenge/PBjT0nQy7m5_bE42I1jr5mMaYxLMma4ONP9FAUgCD3c [2a02:2268:ffff:ffff::4]: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p"
IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: mydomain.nl
   Type:   unauthorized
   Detail: Invalid response from
   http://mydomain.nl/.well-known/acme-challenge/PBjT0nQy7m5_bE42I1jr5mMaYxLMma4ONP9FAUgCD3c
   [2a02:2268:ffff:ffff::4]: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD
   HTML 2.0//EN\">\n<html><head>\n<title>404 Not
   Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p"

   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.

我也试过在配置中添加这个块:

location ~ /.well-know/acme-challenge {
    allow all;
    root /var/www/mydomain.nl/html;
}

但是没有成功。我可以在我的域上访问我的网站,因此 DNS 应该是正确的。

您的域注册商已为您的域预配置 AAAA 记录。从您的 DNS 设置中删除 AAAA 记录。在您的情况下,删除 "wwww.mydomain.nl AAAA 2a02:2268:ffff:ffff::4" 记录。