我有一个使用以下配置运行的Nginx服务
location /.well-known {
root /tmp/letsencrypt/;
}
我执行以下docker命令
sudo docker run -it --rm --name certbot \
-v /etc/letsencrypt \
-v /var/lib/letsencrypt \
-v /tmp/letsencrypt \
quay.io/letsencrypt/letsencrypt:latest certonly \
--webroot --webroot-path /tmp/letsencrypt \
-d dev.blockloop.io --renew-by-default
我从letencrypt得到以下输出
Type: unauthorized
Detail: Invalid response from
http://dev.blockloop.io/.well-known/acme-challenge/wupz1YYLDRv8dJRYegoFXfZ24rJCwRrenQxBoYndO30:
"<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>"
我的nginx日志说
nginx_1 | 2016/05/28 20:10:44 [error] 6#6: *1 open() "/tmp/letsencrypt/.well-known/acme-challenge/wupz1YYLDRv8dJRYegoFXfZ24rJCwRrenQxBoYndO30" failed (2: No such file or directory), client: 66.133.109.36, server: dev.blockloop.io, request: "GET /.well-known/acme-challenge/wupz1YYLDRv8dJRYegoFXfZ24rJCwRrenQxBoYndO30 HTTP/1.1", host: "dev.blockloop.io"
nginx_1 | 66.133.109.36 - - [28/May/2016:20:10:44 +0000] "GET /.well-known/acme-challenge/wupz1YYLDRv8dJRYegoFXfZ24rJCwRrenQxBoYndO30 HTTP/1.1" 404 169 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)"
当我查看/ tmp / letsencrypt时,我希望看到letencrypt遗留的一些文件,但是唯一的事情是空的.well-known目录。我怀疑letencrypt正在清理或未在创建文件。
如果我将index.html文件放入
/tmp/letsencrypt/.well-known
中并转到http://dev.blockloop.io/.well-known/,我会看到其内容,因此我知道nginx可以正常工作。 最佳答案
我设法以某种方式解决了这个问题。我认为解决方案是--webroot-path /tmp/letsencrypt/
末尾的斜杠,但谁知道。这是生成的脚本。其他一切保持不变。
sudo docker run -it --rm --name certbot \
-v "/etc/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
-v "/tmp/letsencrypt:/tmp/letsencrypt" \
quay.io/letsencrypt/letsencrypt:latest certonly \
--webroot --webroot-path /tmp/letsencrypt/ \
-d dev.blockloop.io --renew-by-default
关于nginx - Docker Letencrypt似乎没有创建Webroot文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37503380/