这可能是一个简单的错误,但是我似乎无法使用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";
}
}
为了验证,我使用了以下certbot命令:
certbot certonly --agree-tos --email <My_EMAIL>@gmail.com --webroot -w /srv/www/<ROOT_FOLDER>/ -d <DOMAIN>.info
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/"
我在这一点上一无所知。所有目录和文件都对所有用户和组具有读取权限。任何建议将不胜感激。
编辑
由于Nginx无法发送质询文件,因此我修改了我的快递服务器以发送文件。快速应用程序可访问,并且很容易发送挑战文件以使certbot
正常工作。虽然不是理想的解决方案,但它确实有效。但是,我将保持职位空缺,以寻求更好的答案。
关于:
对域的挑战失败
如果您没有在防火墙中打开端口443
,则可能发生此错误。
我尝试使certbot
在AWS上工作时遇到相同的问题。经过一番尝试后,我只需要在与EC2实例关联的安全组中打开端口443
。