我不明白如何验证我的 letsencrypt 域名。
$ ./letsencrypt-auto certonly -a webroot --webroot-path=/home/my_user1/my_domain -d my_domain.com -d www.my_domain.com
Requesting root privileges to run certbot...
/home/my_user1/.local/share/letsencrypt/bin/letsencrypt certonly -a webroot --webroot-path=/home/my_user1/my_domain -d my_domain.com -d www.my_domain.com
Failed authorization procedure. my_domain.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://my_domain.com/.well-known/acme-challenge/aaa: "<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>", www.my_domain.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://www.my_domain.com/.well-known/acme-challenge/bbbb: "<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>"
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: my_domain.com
Type: unauthorized
Detail: Invalid response from
http://my_domain.com/.well-known/acme-challenge/aaaaa:
"<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>"
Domain: www.my_domain.com
Type: unauthorized
Detail: Invalid response from
http://www.my_domain.com/.well-known/acme-challenge/bbbb:
"<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>"
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A record(s) for that domain
contain(s) the right IP address.
之后,我在 acte-challenge 目录中创建了这两个文件,重新运行脚本,但这次它请求了两个不同的文件。也就是说,它总是先行一步,无法知道下次会生成什么文件。
我该怎么办呢?
答案1
错误消息
请求 root 权限来运行 certbot...
并且$似乎$ ./letsencrypt-auto
表明您正尝试以非特权用户身份运行 letsencrypt。
Let's Encrypt 客户端...需要 root 权限为了写入
/etc/letsencrypt
、、/var/log/letsencrypt
;/var/lib/letsencrypt
绑定到端口80
和443
(如果您使用独立插件)以及读取和修改 Web 服务器配置(如果您使用 apache 或 nginx 插件)。
Cert-bot 稍微宽容一些,但需要附加参数当你不以 root 身份运行时:
webroot 和 manual 插件无需 root 权限即可正常工作。但是,您需要为 Certbot 的工作目录提供可写路径,方法是确保 、
/etc/letsencrypt/
、/var/log/letsencrypt/
可/var/lib/letsencrypt/
写,或者使用--config-dir
,--logs-dir
, 和--work-dir
旗子。