Certbot HTTP-01 质询失败

Abr*_*ain 4 nginx lets-encrypt certbot

这可能是一个简单的错误,但我似乎无法certbot用来验证我的域。我正在使用连接到快速应用程序的 nginx。我已经注释掉了默认 nginx 文件中的配置,它只包含我的站点的配置/etc/nginx/conf.d/mysite.info。在我的配置中,第一个位置条目指向根/.well-known/acme-challenge目录。这是我的 nginx conf 文件中的设置:

server {
    listen 80;

    server_name <MYDOMAIN>.info www.<MYDOMAIN>.info;

    location '/.well-known/acme-challenge' {
            root /srv/www/<MY_ROOT_DIRECTORY>;
    }

    location / {
            proxy_pass http://localhost:4200;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
    }
    location /secure {
            auth_pam "Secure zone";
            auth_pam_service_name "nginx";
    }

}
Run Code Online (Sandbox Code Playgroud)

为了验证,我使用了以下 certbot 命令:

certbot certonly --agree-tos --email <My_EMAIL>@gmail.com --webroot -w /srv/www/<ROOT_FOLDER>/ -d <DOMAIN>.info
Run Code Online (Sandbox Code Playgroud)

certbot的错误如下:

Performing the following challenges:
http-01 challenge for <MYDOMAIN>.info
Using the webroot path /srv/www/<ROOT_FOLDER> for all unmatched domains.
Waiting for verification...
Challenge failed for domain <MYDOMAIN>.info
http-01 challenge for <MYDOMAIN>.info
Cleaning up challenges
Some challenges have failed.

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: <MYDOMAIN>.info
   Type:   unauthorized
   Detail: Invalid response from
   http://<MYDOMAIN>.info/.well-known/acme-challenge/Yb3c1WtCn5G43YatrhVorTbT_nn3WKTLwKjr0c9dW8E
   [74.208.<...>.<...>]: "<!DOCTYPE html>\n<html
   lang=\"en\">\n<head>\n<meta
   charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot
   GET /.well-known/"
Run Code Online (Sandbox Code Playgroud)

在这一点上,我真的一无所知。所有目录和文件对所有用户和组都具有读取权限。任何建议将不胜感激。

编辑

由于 Nginx 无法传送挑战文件,我修改了我的快递服务器以发送文件。express 应用程序是可访问的,并且很容易发送挑战文件以开始certbot工作。虽然不是理想的解决方案,但它起作用了。但是,我会保持帖子开放以获得更好的答案。

Dhe*_*rik 8

关于:

域挑战失败

如果您没有443在防火墙中打开端口,就会发生此错误。

我在尝试certbot在 AWS 上工作时遇到了同样的问题。经过一些尝试,我只需要打开443与 EC2 实例关联的安全组中的端口。