Dea*_*del 5 encryption nginx unauthorized lets-encrypt
在服务器上,安装了 Nginx。Let's Encrypt 在 www.domain.com 上运行良好,但不适用于 static.domain.com
使用 PuTTY,当我输入时:
sudo letsencrypt certonly -a webroot --webroot-path=/var/www/site/domain -d static.domain.com -d domain.com -d www.domain.com
我有以下问题:
Failed authorization procedure. static.domain.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://static.domain.com/.well-known/acme-challenge/c6zngeBwPq42KLXT2ovW-bVPOQ0OHuJ7Fw_FbfL8XfY: "<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>"
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: static.domain.com
Type: unauthorized
Detail: Invalid response from
http://static.domain.com/.well-known/acme-challenge/c6zngeBwPq42KLXT2ovW-bVPOQ0OHuJ7Fw_FbfL8XfY:
"<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</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.
Run Code Online (Sandbox Code Playgroud)
有人知道可能是什么问题吗?
当我第一次尝试在我的网站上安装证书时,我从 certbot 收到了相同的错误消息。
我使用的是 apache2,而不是 nginx。我在我的网站上查看了与403 Forbidden事件/var/log/apache2/error.log相关的 apache2 错误消息的日志,我发现:
[Sun Aug 26 14:16:24.239964 2018] [core:error] [pid 12345] (13)Permission denied: [client 12.34.56.78:1234] AH00035: access to /.well-known/acme-challenge/5PShRrf3tR3wmaDw1LOKXhDOt9QwyX3EVZ13JklRJHs denied (filesystem path '/var/lib/letsencrypt/http_challenges') because search permissions are missing on a component of the path
Run Code Online (Sandbox Code Playgroud)
我用谷歌搜索了这个错误信息,发现 apache2 无法读取上面提到的目录(例如/var/lib/letsencrypt/http_challenges),因为权限不正确,例如:
$ sudo ls -la /var/lib/letsencrypt/
total 16
drwxr-x--- 4 root root 4096 Aug 26 14:31 .
drwxr-xr-x 72 root root 4096 Aug 18 00:48 ..
drwxr-x--- 27 root root 4096 Aug 26 14:26 backups
drwxr-xr-x 2 root root 4096 Aug 26 14:27 http_challenges
Run Code Online (Sandbox Code Playgroud)
因此,根据上面带有一个点 ( .) 表示letsencrypt具有权限的文件夹的行,rwxr-x---除了 root 用户之外,没有人可以读取其内容。为了纠正权限,我只是做了:
$ sudo chmod o+rx /var/lib/letsencrypt
Run Code Online (Sandbox Code Playgroud)
将上述$ ls命令输出更改为:
$ ls -la /var/lib/letsencrypt/
total 16
drwxr-xr-x 4 root root 4096 Aug 26 14:31 .
drwxr-xr-x 72 root root 4096 Aug 18 00:48 ..
drwxr-x--- 27 root root 4096 Aug 26 14:26 backups
drwxr-xr-x 2 root root 4096 Aug 26 14:27 http_challenges
Run Code Online (Sandbox Code Playgroud)
现在,上面带有点 (.) 代表letsencrypt目录的行表示rwxr-xr-x,以便“其他用户”(例如apache2 的用户www-data)现在可以读取和浏览letsencrypt目录。
然后certbot按预期工作。
我猜您的子域有另一个网络根目录,如果是这样,只需指定该网络根目录。在您的示例中,您有相同的 webrootboth static.domain.com和domain.com。
来自https://certbot.eff.org/docs/using.html
\n\n\n\n如果您同时获取多个域的证书,则插件需要知道每个域的文件从哪里提供,这可能是每个域的单独目录。为多个域请求证书时,每个域将使用最近指定的 --webroot-path
\n\n\n
certbot certonly --webroot -w /var/www/example/ -d www.example.com -d\n example.com -w /var/www/other -d other.example.net -d\n another.other.example.net
| 归档时间: |
|
| 查看次数: |
12281 次 |
| 最近记录: |