安装let’s encrypt
一、 安装letsencryp
git clone https://github.com/letsencrypt/letsencrypt
二、通过Certbot snap安装证书并续订
1、SSH到服务器
以具有sudo权限的用户SSH到运行HTTP网站的服务器。
2、安装snapd
您需要安装snapd,并确保遵循任何说明来启用经典的snap支持。
按照snapcraft网站上的说明安装snapd。
apt install -y snapd
3、安装Certbot
在机器的命令行上运行这个命令来安装Certbot。
snap install --classic certbot
4、选择您希望如何运行Certbot
运行此命令获取证书,并让Certbot自动编辑您的nginx配置以提供证书,在一个步骤中打开HTTPS访问。
certbot --nginx
如果你感觉更保守,想手工修改nginx配置,运行这个命令。
certbot certonly --nginx
5、测试自动更新(自动续订)
系统上的Certbot包附带一个cron作业或系统计时器,它将在证书过期前自动更新证书。您不需要再次运行Certbot,除非您更改了配置。您可以通过运行以下命令来测试证书的自动续订:
certbot renew --dry-run
查看自动任务
systemctl list-timers
此时自动任务里已经有 snap.certbot.renew.timer
来源:
1、Let’s Encrypt 安装配置教程,免费的 SSL 证书 https://zhuanlan.zhihu.com/p/196638669
2、certbot instructions
Nginx on Ubuntu 20 https://certbot.eff.org/instructions?ws=nginx&os=ubuntufocal
本章结束~ifan