官网: https://certbot.eff.org/lets-encrypt/ubuntubionic-nginx
ssl安装检测工具: https://www.myssl.cn/tools/check-server-cert.html (检测证书有什么问题)
- 先使用sudo /usr/sbin/nginx -t 检查nginx配置文件是否有语法错误(好像是进入/etc/nginx下也可以使用nginx -t 检查语法)
-
然后在/etc/letsencrypt目录下运行 sudo certbot --nginx (第一次是在这个目录下运行的此命令,不确定是否必须在这个目录下运行此命令) ##因为certbot已经是安装完成的,所以直接进行证书安装,否则需要安装官网的步骤来做,添加一个PPA源,安装certbot,再安装证书##
- Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access(手动选择1 or 2) 1: No redirect 可以同时使用http 和 https 2: redirect 把http301重定向到https.就是说只能https才能访问??(猜测应该是这样) 我选择了 1
- ------------------------------------------------------更新证书-------------------------------------------------------------------
- 证书有过期时间(90天),好像之前是没有写自动续期的定时任务。所以过期了,本来安照官网执行 sudo certbot renew --dry-run 后来发现此命令只是测试续期的, 不会真正续期, 需要使用其他命令续期。
- ./certbot-auto renew --quiet --no-self-upgrade (这个提示了没有找到./certbot-auto, 所以没执行成功)
- 最后使用的方法是 sudo certbot --nginx (就是安装的命令,不过他判断证书已存在会自动进行更新,而不是安装,也需要选择是否重定向)
- 查阅: 更新使用的是 certbot-auto renew --force-renewal (强制更新域名的证书,即使离过期时间还很久, 不过这次更新没有尝试使用, 使用的是安装的命令,所以不知道好不好用)
-
参考: https://blog.csdn.net/kikajack/article/details/79122701
请看: https://10.linuxstory.net/deploy-lets-encrypt-ssl-certificate-with-certbot/
配置https证书
原文:https://www.cnblogs.com/bneglect/p/11421322.html