在nginx服务器上安装“让我们加密”时出错

时间:2019-05-01 09:50:13

标签: nginx ssl-certificate lets-encrypt manual

我正在尝试在四个站点上安装“让我们加密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,然后按Enter。然后,我按照以下步骤操作:

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证书吗?

谢谢。

1 个答案:

答案 0 :(得分:0)

我设法解决了我的问题。我必须首先在我的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证书,然后按照成功安装证书的步骤进行操作。

相关问题