我正在尝试建立 SSL 连接,这样我进入网站的用户就不会因为不安全的 HTTP 而拒绝停留。基本上我正在尝试从 HTTP 迁移到 HTTPS。
我学习了很多手册和教程,所以这里是我所做的事情的精髓:
首先我通过以下方式下载了letscrypt:
mkdir ~/letsencrypt
cd ~/letsencrypt
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
./letsencrypt-auto --help
然后我移动到我的 nginx 配置并更正它:
/etc/nginx/sites-available/myptoject
server {
listen 83;
server_name domainname.tk;
location / {
include uwsgi_params;
uwsgi_pass unix:/var/www/flaskapp/myproject.sock;
}
}
在 ~/letsencrypt/letsencrypt 中我运行:
./letsencrypt-auto --apache -d domainname.tk
一切顺利后,我输入了首选协议(HTTP 和 HTTPS,我的电子邮件),但最终显示了消息:
Plugins selected: Authenticator nginx, Installer nginx
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for domainname.tk
Using default address 80 for authentication.
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. domainname.tk (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authoriza tion :: Invalid response from http://domainname.tk/.well-known/acme-challenge/qD7pzA8UtegkcXIhoOQUvCM92eG5hrahtYOLAYJAujw: "< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<titl"
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: domainname.tk
Type: unauthorized
Detail: Invalid response from
http://domainname.tk/.well-known/acme-challenge/qD7pzA8UtegkcXIhoOQUvCM92eG5hrahtYOLAYJAujw:
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<titl"
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.
当名称之间存在一些冲突时,就会发生此错误(据我现在搜索),但您可以在这里看到命名一切正常。在这两种情况下我都有domainname.tk
。
我正在使用flask、python、nginx、uwsgi,我的工作目录(/var/www/flaskapp/)如下所示:
drwxrwxrwx 7 john john 4096 фев 10 19:57 .
drwxr-xr-x 4 john john 4096 фев 6 21:55 ..
-rwxrwxr-x 1 john john 61939 янв 26 04:50 certbot-auto
drwxrwxr-x 8 john john 4096 фев 10 11:55 .git
-rw-rw-r-- 1 john john 150 фев 9 19:18 home.html
-rw-r--r-- 1 root root 186 фев 8 21:46 myproject.ini
-rw-rw-r-- 1 john john 772 фев 10 17:55 myproject.py
-rw-r--r-- 1 root root 12288 фев 10 16:27 .myproject.py.swo
srw-rw---- 1 john www-data 0 фев 10 18:35 myproject.sock
drwxr-xr-x 2 john www-data 4096 фев 10 17:55 __pycache__
-rw-rw-r-- 1 john john 104 фев 9 18:18 requirements.txt
drwxrwxr-x 2 john john 4096 фев 9 19:18 templates
drwxrwxrwx 5 john john 4096 фев 8 21:44 venv
drwxrwxr-x 3 john john 4096 фев 10 19:58 .well-known
-rw-r--r-- 1 root root 68 фев 8 21:45 wsgi.py
我手动创建了 .well-known/acme-challenge 目录。
所以我不知道这里出了什么问题。它看起来工作正常,但我在尝试建立 SSL 密钥时遇到错误。任何人都可以帮忙吗?
操作系统是 Ubuntu 16.04 LTS
任何帮助将不胜感激!
编辑一个
我应该补充一下,当我去时会发生什么http://domainname.tk/.well-known/acme-challenge/qD7pzA8UtegkcXIhoOQUvCM92eG5hrahtYOLAYJAujw
我看到我的主页,没有其他内容。html 代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>domainname.tk</title>
<meta name="description" content="domainname.tk">
<meta name="keywords" content="domainname.tk">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-23441223-3']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<frameset rows="*">
<frame frameborder=0 src="http://myipaddress:83/" name="dot_tk_frame_content" scrolling="auto" noresize>
</frameset>
</html>