【发布时间】:2017-08-10 16:38:30
【问题描述】:
我正在尝试在Django 1.8 上运行的网页上设置https。我是这个领域的新手,所以我使用Certbot。我按照说明操作直到./path/to/certbot-auto certonly。
您希望如何通过 ACME CA 进行身份验证?
- 1:将文件放在webroot目录(webroot)
- 2:启动临时网络服务器(独立)
我选择了 1。
然后它想要我的域,下一步是:
选择salix.sk的webroot:
>>> /home/django/salix
返回错误
等待验证...清理挑战失败 授权程序。 salix.sk (http-01): urn:acme:error:unauthorized :: 客户端缺少足够的 授权 :: 来自无效的响应 http://salix.sk/.well-known/acme-challenge/some_code: "
页面不”重要提示: - 服务器报错如下:
域:salix.sk 类型:未授权详细信息:无效 来自
http://salix.sk/.well-known/acme-challenge/some_code的回复: " 页面不”要修复这些错误,请确保您的域名是
正确输入和该域的 DNS A 记录
包含正确的 IP 地址。
我认为我应该以某种方式在我的项目中设置路径,但不知道如何设置。它在我的项目的根目录内创建了一个文件夹.well-known,里面没有任何可见文件。
你知道该怎么做吗?
编辑:
我已更改 etc/nginx/sites-available/default 添加到服务器部分:
location ~ /.well-known {
allow all;
}
所以:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass http://127.0.0.1:8080;
#}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/html;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
# fastcgi_index index.php;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
location ~ /.well-known {
allow all;
}
}
这也没有帮助。
【问题讨论】:
-
您使用 /usr/share/nginx/html 路径作为 html nginx 根目录。因此,您应该为 Certbot 指定相同的路径。类似 ./path/to/certbot-auto certonly --webroot -w /usr/share/nginx/html -d salix.sk
标签: ubuntu nginx https certificate certbot