在 nginx 服务器上安装 Let's Encrypt 时出错

Error installing Let's Encrypt on nginx server

我正在尝试在四个站点上安装 Let's Encrypt SSL 证书: mysite.com es.mysite.com fr.mysite.com de.mysite.com

我 运行 以下命令:certbot --nginx -d mysite.com -d www.mysite.com 对 mysite.com、es.mysite.com、fr.mysite.com 工作正常。当我 运行 sudo certbot --nginx -d de.mysite.com 出现以下错误时:

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: de.mysite.com
   Type:   unauthorized
   Detail: Invalid response from
   https://de.mysite.com/.well-known/acme-challenge/te29XBKAQdQBbQxvzPTgfgaFpzM_OUj6b4gSuiuPvOI
   [MY IP ADDRESS]: "\r\n\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML
   1.0 Transitional//EN\"
   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<"

   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.

然后我尝试使用以下代码手动安装证书:certbot certonly --manual -d de.mysite.com。然后有人问我 Are you ok with your IP being loggged? 我选择 Y 并按回车键。然后我按照这个步骤:

Create a file containing just this data:

SJpIiQET8X0vehhTjmcPBrm3zsbS1p8f9Mf2oKE5l5w.SkXszSMjtmN2-3gN7kkDhgSElerR3H1MgUc9N8z70n4

And make it available on your web server at this URL:

http://de.mysite.com/.well-known/acme-challenge/SJpIiQET8X0vehhTjmcPBrm3zsbS1p8f9Mf2oKE5l5w

我按 Enter 键继续,然后得到同样的错误:

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: de.mysite.com
   Type:   unauthorized
   Detail: Invalid response from
   https://de.mysite.com/.well-known/acme-challenge/SJpIiQET8X0vehhTjmcPBrm3zsbS1p8f9Mf2oKE5l5w
   [MY IP ADDRESS]: "\r\n\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML
   1.0 Transitional//EN\"
   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<"

   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.

任何人都可以建议如何解决此错误并成功安装 Let's Encrypt SSL 证书吗?

谢谢。

我设法解决了我的问题。我必须首先在我的 nginx 配置中包含以下内容:

   location ~ /.well-known {
      allow all;
   }

   location ^~ /.well-known/acme-challenge/ {
      default_type "text/plain";
      root         /data/wordpress/mysite/;
   }

   location = /.well-known/acme-challenge/ {
      return 404;
   }

然后我不得不通过 运行 certbot certonly --manual -d de.mysite.com 手动安装 Let's Encrypt SSL 证书并按照步骤成功安装证书。