lets-encrypt - Certbot 没有创建众所周知的文件夹(它怎么知道在哪里这样做?)
问题描述
在我的服务器上安装了 certbot。除了 WSGI 服务的 Django 应用程序之外,它对所有服务器都很好。
当我用它更新证书时,sudo certbot renew
它说挑战没有完成。我的网络根目录是/srv/site
. 不知何故,certbot 知道它需要在static/.well-known/acme-challenge
. (我想知道它是如何知道这一点的,但它确实是正确的)。
如果我自己创建这个文件夹,并在其中放置一个文件“hello”,我可以通过访问www.site.com/static/.well-known/acme-challenge/hello来检索它。那么为什么 letencrypt 不能访问它所带来的挑战呢?
似乎它没有创建此文件。甚至不是文件夹结构,尽管以 root 身份运行并且能够创建它喜欢的任何文件夹。我watch -n 0.5 ls -a /srv/site/static
用来查看是否创建了 .well-known 文件夹,但没有。
为什么?
完整错误:
user@host:/srv/site$ sudo certbot renew
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/domain.tld.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator webroot, Installer None
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for site.domain.tld
Waiting for verification...
Cleaning up challenges
Attempting to renew cert (site.tld) from /etc/letsencrypt/renewal/domain.tld.conf produced an unexpected error: Failed authorization procedure. site.domain.tld (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from https://site.domain.tld/static/.well-known/acme-challenge/yD-WpiQsGL1E_fvs2m-U6UDuHdLCh6shuJkmUdIzhXs [139.162.191.205]: "<!doctype html>\n<html lang=\"en\">\n<head>\n<link href=\"https://fonts.googleapis.com/icon?family=Material+Icons\" rel=\"stylesheet\">\n<". Skipping.
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/domain.tld/fullchain.pem (failure)
解决方案
您提到您将 webroot 设置为/srv/site
. 因此,certbot 会将挑战放在/srv/site/.well-known/acme-challenge
而不是放在/static/.well-known/acme-challenge/
. 此外,certbot 会在certbot
命令完成后清除挑战,因此您不会在那里找到挑战文件。我认为您需要将 webroot 更改为static
.
让我知道解决方案是否有效。我真的很想得到关于我的答案的反馈:)
推荐阅读
- redis - 用于 Azure 消费函数的 Redis 连接最佳实践
- amazon-web-services - 在 CW 度量数学中计算当前时间戳
- python - 安装 cx_Freeze
- extjs - 如何修改 Sencha Ext.form.HtmlEditor 行为?
- php - 从给定的出生日期计算年龄组
- reporting-services - 来自 Lookup() 的钻取参数值
- jenkins - Bitbucket 服务器:合并检查 - 即使在满足条件后,最小成功构建也不会启用合并
- java - Mac OS HSDB HotSpot Debugger 无法附加到进程
- async-await - .NET Core 2.1,Manjuro Linux 在没有 ConfigureAwait(false) 的情况下失败
- postgresql - 将 Heroku 应用程序连接到外部数据库