Nginx/Certbot - 来自域/.well-known 的无效响应

问题描述 投票:0回答:4

我正在尝试在运行于

https
上的网页上设置
Django 1.8
。我在这个领域非常陌生,所以我使用 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;
        }
}

这也没有帮助。

ubuntu nginx https certificate certbot
4个回答
0
投票

就我而言,nginx 配置运行良好:

location ^~ /.well-known {
        if ($request_uri ~* /.well-known/acme-challenge/(.*)) {
        set $tmp $1.ZzFvB6sHz7artk-kNCGMNtB_adt6f5K2tuL8Mf8uL1c;
    }
    return 200 $tmp;

在这里,我获取了 $1 - request_uri 末尾的第一个元素,添加了一个由 certbot 在

certbot renew
命令执行期间生成的字符串。

但我不确定下次是否会起作用。


0
投票

删除 IPv6 地址的 AAAA 记录 - 为我修复


0
投票

可以使用root用户运行

在nginx.conf中设置代码

用户root root;


-1
投票

尝试:

  1. apt更新,apt升级

  2. 将时区和日期/时间更改为实际值

  3. 删除 IPv6 地址的 AAAA 记录

© www.soinside.com 2019 - 2024. All rights reserved.