更改已注册的letsencrypt证书的webroot路径

时间:2016-06-22 06:58:34

标签: ssl nginx lets-encrypt

我是Let's Encrypt证书的新手。我在 digitalocean.com 上按照此命令

为我的域注册了nginx服务器
  

cd / opt / letsencrypt ./letsencrypt-auto certonly -a webroot   --webroot-path = / usr / share / nginx / html -d mydomain.com -d www.mydomain.com

它工作正常。然后我将 webroot路径更改为我的域的 / var / www / xxx 。 现在当我试图更新我的letsencrypt证书时,它正在收到错误。 然后我回滚我的webroot路径,再试一次,续订工作完美。 现在我的问题是如何更改已注册的 webroot-path 以便让我们加密?

2 个答案:

答案 0 :(得分:13)

在/etc/letsencrypt/renewal/mydomain.conf

中更改它

设置

authenticator = webroot
webroot_path=/var/www/xxx/

和关键时刻花了我几个小时来弄清楚 - 使用webroot_path=/var/www/xxx/而不是webroot-path=/var/www/xxx配置webrooth路径,请注意下划线

答案 1 :(得分:0)

您不必在nginx中回滚您的webroot路径,只需在运行时更改webroot值即可加密脚本。

/opt/letsencrypt/letsencrypt-auto certonly -a webroot --webroot-path=/var/www/xxx -d mydomain.com -d www.mydomain.com

letsencrypt脚本需要您的webroot,因为身份验证基于添加到您的webroot的文件,该文件应该在/.well-known/acme-challenge/下,身份验证过程包括对这些文件的外部请求,因此如果两个webroot值不是&#39 ; t匹配,您将看到一个错误,因为auth服务器无法访问该文件。每次尝试获取/续订证书时,只需确保从nginx传递完全相同的根值即可加密。

相关问题