Django is unable to issue a certificate for Let's Encrypt><.

Asked 1 years ago, Updated 1 years ago, 106 views

I'm sorry to bother you at such a busy time, but I was thinking about SSL in Django, but I can't issue a Let's Encrypt certificate.


Conoha VPS 1G OS CentOS 7.5
Apache 2.4.6
python 3.6.5
Django 2.0.7

https://hombre-nuevo.com/vps/vps0023/
I set it up with reference, but I get an error when I issue a certificate.

·Added to settings.py

CERT_ROOT=os.path.join(BASE_DIR, '.well-known')
CERT_URL='/.well-known/'

ALLOWED_HOSTS = ['www.[Retrieved Domain]', 'Retrieved Domain']

·Added to urls.py

 from django.conf.urls.static import static
from django.conf import settings

urlpatterns+=static(settings.CERT_URL, document_root=settings.CERT_ROOT)

·Create a static file for testing

/var/www/cgi-bin/***/---/.well-known/acme-challenge/test.html

(shown in the web browser)
*** →Django Project name
--- →Django app name


80
443
Opened

certbot certonly --webroot-w/var/www/cgi-bin/***/---/.well-known/-d [no domain www obtained] --- email = [email address]

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

   Domain: None retrieved domain www
   Type—unauthorized
   Detail—Invalid response from
   http:// [No domain www obtained]/.well-known/acme-challenge/oMwTbqaN_LocYGh1OywMgoES6LZkaeY5TJIfwkIu8Jc:
   "<!DOCTYPE HTML PUBLIC" -//IETF//DTD HTML 2.0//EN" >
   <html><head>
   <title> 404 Not Found</title>
   </head><body>
   <h1>Not Found</h1>
   <p"

   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.

The domain was acquired in the Moomoo domain and is currently operating normally without SSL.
DNS configuration:

A (typical) @TTL3600 [IP-Address]
A (typical) wwww TTL3600 [IP-Address]
NS@TTL3600 ns-a1.conoha.io
NS@TTL3600 ns-a2.conoha.io
NS@TTL3600 ns-a3.conoha.io

LoadModule wsgi_module/usr/lib64/python 3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so
WSGIPythonPath/var/www/cgi-bin/***

WSGIScriptAlias//var/www/cgi-bin/***/***/wsgi.py
Alias/static//var/www/cgi-bin/***/---/static/

<Directory//var/www/cgi-bin/***/***/wsgi.py>
  <Files wsgi.py>
    Require all graded
  </Files>
</Directory>

<Directory/var/www/cgi-bin/***/---/static>
    Require all graded
</Directory>

Add to Last Line

Alias/.well-known/acme-challenge//var/www/cgi-bin/***/---/.well-known/acme-challenge/
<location.well-known="">
    Options - Indexes
</location>

It seems to be a problem on the part of DNS, but it's hard to solve and I'm broken...
If there are any solutions or errors, please let me know.

I am very sorry to bother you at such a busy time, but I appreciate your cooperation.

django ssl letsencrypt

2022-09-29 21:55

1 Answers

specifies the root of the domain with the -w option, so I think you need to modify it as follows:

certbot certonly --webroot-w/var/www/cgi-bin/***/---d [No domain www obtained] ---mail=[email address]

Recent Let's Encrypt configurations have become more automated and very simple.In this case, apache plug-in can be inserted below, and there is no need to add -w to the last line.Items that need to be entered are prompted at the prompt, but the number of items is decreasing.

 sudo certbot --apache

Or, if you want to configure Apache yourself,

 sudo certbot -- apache certonly


2022-09-29 21:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.