Django&Certbot-未经授权,无效响应(HTTPS)

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

我正在尝试使用Nginx配置Certbot(Letsencrypt)。

我收到此错误:

 - The following errors were reported by the server:

   Domain: koomancomputing.com
   Type:   unauthorized
   Detail: Invalid response from
   http://koomancomputing.com/.well-known/acme-challenge/xvDuo8MqaKvUhdDMjE3FFbnP1fqbp9R66ah5_uLdaZk
   [2600:3c03::f03c:92ff:fefb:794b]: "<html>\r\n<head><title>404 Not
   Found</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>404
   Not Found</h1></center>\r\n<hr><center>"

   Domain: www.koomancomputing.com
   Type:   unauthorized
   Detail: Invalid response from
   http://www.koomancomputing.com/.well-known/acme-challenge/T8GQaufb9qhKIRAva-_3IPfdu6qsDeN5wQPafS0mKNA
   [2600:3c03::f03c:92ff:fefb:794b]: "<html>\r\n<head><title>404 Not
   Found</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>404
   Not Found</h1></center>\r\n<hr><center>"

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address.
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.

在/ etc / nginx / sites-available / koomancomputing中:

server {
listen 80;
server_name koomancomputing.com www.koomancomputing.com;

location = /favicon.ico { access_log off; log_not_found off; }
location /staticfiles/ {
    root /home/kwaku/koomancomputing;
}

location /media/ {
    root /home/kwaku/koomancomputing;
}

location / {
    include proxy_params;
    proxy_pass http://unix:/run/gunicorn.sock;
}
}

我的DNS A / AAAA记录:

enter image description here

我不知道该怎么办,所以我进行了搜索并找到了django-letsencrypt应用程序,但是我不知道该如何使用:enter image description here

django nginx https certbot
1个回答
0
投票

您的Nginx服务器正在响应404错误,因为它没有定义certbot验证挑战所需的/.well-known路由。您需要修改Nginx配置文件,以告诉它如何应对certbot的挑战。

Certbot可以为您更新Nginx配置文件。

  • 首先,请确保您的配置文件已启用。运行sudo service nginx reload并检查是否存在名为/etc/nginx/sites-enabled/koomancomputing的文件。

  • 然后,运行certbot --nginx -d koomancomputing.com -d www.koomancomputing.com

[--nginx标志告诉certbot查找具有匹配服务器名称的Nginx配置文件,并使用SSL信息更新该文件。

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