Есть VPS с несколькими сайтами на Flask, конфиг nginx:
server {
listen 80;
server_name sitename.ru www.sitename.ru;
location /.well-known {
root /home/username/sites/sitename.ru/flask_app/templates;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/username/sites/sitename.ru/flask_app/sitename.sock;
}
}
делал по этому туториалу -
https://www.digitalocean.com/community/tutorials/h...
Теперь ума не приложу как подключить HTTPS посредством certbot
https://certbot.eff.org/ ???
Попробовал кучу туториалов, но видимо я настолько криворук (((.
добавил во Flask
# wildcard route for ssl verification
@app.route('/', defaults={'path': ''})
@app.route('/.well-known/<path:path>')
def ssl_cert(path):
return render_template('.well-known/' + path)
Создал тестовую страницу с этой директорией
127.0.0.1:5000/.well-known/test.html
работает
Допустим по этому тутору -
https://habrahabr.ru/post/318952/
У меня затык с получением сертификатов после команды
certbot certonly --dry-run -d example.com -d www.example.com
sudo certbot certonly --dry-run -d sitename.ru -d www.sitename.ru
Saving debug log to /var/log/letsencrypt/letsencrypt.log
How would you like to authenticate with the ACME CA?
-------------------------------------------------------------------------------
1: Nginx Web Server plugin - Alpha (nginx)
2: Spin up a temporary webserver (standalone)
3: Place files in webroot directory (webroot)
-------------------------------------------------------------------------------
Select the appropriate number [1-3] then [enter] (press 'c' to cancel): 3
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-staging-v02.api.letsencrypt.org
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for sitename.ru
http-01 challenge for www.sitename.ru
Input the webroot for sitename.ru: (Enter 'c' to cancel): /home/username/sites/sitename.ru/flask_app/templates/.well-known
Select the webroot for www.sitename.ru:
-------------------------------------------------------------------------------
1: Enter a new webroot
2: /home/username/sites/sitename.ru/flask_app/templates/.well-known
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. www.sitename.ru (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://www.sitename.ru/.well-known/acme-challenge/2E4cltwPGNZR-Z5lJZfYES5q0fQPCyg6mbtaJNccp-A: "\ufeff<!DOCTYPE html>
<meta charset="utf-8">
<html lang="ru">
<head>
<title>\u041e\u0410\u041e \xab\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438\xbb ", sitename.ru (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://sitename.ru/.well-known/acme-challenge/ipbROalh3pstmv_4wA0EzgO0nu8zAk3Hf06k0Wu8bYc: "\ufeff<!DOCTYPE html>
<meta charset="utf-8">
<html lang="ru">
<head>
<title>\u041e\u0410\u041e \xab\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438\xbb "
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: www.sitename.ru
Type: unauthorized
Detail: Invalid response from
http://www.sitename.ru/.well-known/acme-challenge/2E4cltwPGNZR-Z5lJZfYES5q0fQPCyg6mbtaJNccp-A:
"<!DOCTYPE html>
<meta charset="utf-8">
<html lang="ru">
<head>
<title>Welcome to site "
Domain: sitename.ru
Type: unauthorized
Detail: Invalid response from
http://sitename.ru/.well-known/acme-challenge/ipbROalh3pstmv_4wA0EzgO0nu8zAk3Hf06k0Wu8bYc:
"<!DOCTYPE html>
<meta charset="utf-8">
<html lang="ru">
<head>
<title>Welcome to site "
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.
letsencrypt.log
https://pastebin.com/bJmcz4X7
Дайте подсказку плиз.