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

Kim*_*der 4 ubuntu ssl vps nginx ubuntu-18.04

我在使用 nginx 和 certbot 将 Let's Encrypt SSL 证书应用于我的域时遇到问题。我的 (Nuxtjs) 网站在装有 Ubuntu 18.04 的 VPS 上运行。我想将证书添加到 mydomain.nl 和 staging.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"
Run Code Online (Sandbox Code Playgroud)
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.
Run Code Online (Sandbox Code Playgroud)

我已经尝试在配置中添加这个块:

location ~ /.well-know/acme-challenge {
    allow all;
    root /var/www/mydomain.nl/html;
}
Run Code Online (Sandbox Code Playgroud)

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

小智 5

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

aaaa-记录示例