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

Imt*_*ain 5 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

它工作正常.然后,我改变了我的根目录路径,以在/ var/WWW/XXX我的域.现在当我试图更新我的letsencrypt证书时,它正在收到错误.然后我回滚我的webroot路径,再试一次,续订工作完美.现在我的问题是如何更改我的注册webroot-path for Let's Encrypt?

Mar*_*als 15

在/etc/letsencrypt/renewal/mydomain.conf中更改它

authenticator = webroot
webroot_path=/var/www/xxx/
Run Code Online (Sandbox Code Playgroud)

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


Lut*_*ion 0

您不必在 nginx 中回滚 webroot 路径,只需在运行 let's encrypt 脚本时更改 webroot 值即可。

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

LetsEncrypt 脚本需要您的 Web 根目录,因为身份验证基于添加到您的 Web 根目录的文件,这些文件应该位于/.well-known/acme-challenge/身份验证过程下,包括对这些文件的外部请求,因此如果两个 Web 根目录值不匹配,您将看到错误,因为身份验证服务器无法访问该文件。每次您尝试获取/更新证书时,只需确保从 nginx 传递完全相同的根值来让我们加密即可。