当我在数字海洋服务器中运行此命令时:
sudo certbot --authenticator webroot --webroot-path /home/james/postr --installer nginx -d <sitename>
我收到此错误:
Failed authorization procedure
The client lacks sufficient authorization :: Invalid response from
http://www.<sitename>.com/.well-known/acme-challenge/oAVGa4eBNfQQ1Vrn_q-
iKjV2T6ue3H5kOcxEWpztrHc
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: www.venvor.com
Type: unauthorized
Detail: Invalid response from
http://www.<sitename>.com/.well-known/acme-challenge/oAVGa4eBNfQQ1Vrn_q-
iKjV2T6ue3H5kOcxEWpztrHc:
"<h1>Not Found</h1><p>The requested URL
/.well-known/acme-challenge/oAVGa4eBNfQQ1Vrn_q-iKjV2T6ue3H5kOcxEWpztrHc
was not found on "
我已经尝试将 URL 路径添加到我的 URL 文件:
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^.well-known/acme-challenge/', admin.site.urls),
]
但是它仍然不起作用。知道问题出在哪里吗?
编辑:
/etc/nginx/sites-available/postr
server {
listen 80;
server_name venvor.com www.venvor.com 174.138.62.249;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/james/postr;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/james/postr/draft1.sock;
}
}
答案1
请将以下位置块添加到您的 nginx 配置文件:
location ^~ /.well-known {
root /your_path_to/document_root;
allow all;
}
怎么运行的 :
Let's Encrypt 验证服务器将在您的 docroot 的子目录中查找客户端创建的验证文件( .well-known)。这意味着这些文件必须是可公开访问的。
在上述位置块中,“^~”修饰符用于匹配非正则表达式。例如,它可以处理 /.well-known/acme-challenge/dkaslf_kfjadlkso^kfds-fkdssjl 的请求。
允许全部指令授予公众对指定文件夹的访问权限。