申请单个域名证书
certbot: https://certbot.eff.org/
安装命令行工具及申请
选择对应的软件和系统版本
# 安装依赖
sudo apt-get install certbot python-certbot-nginx
# 自动设置
sudo certbot --nginx
# or 手动设置
sudo certbot certonly --nginx
设置自动续签
# 通用
sudo certbot renew
# 强制续签
sudo certbot renew --dry-run
申请通配符域名证书
阿里云等国内域名商购买域名
申请证书
sudo certbot certonly --manual / # 通配符模式
-d *.example.com / # 个人域名
--email domain@example.com / # 购买域名邮箱
--server https://acme-v02.api.letsencrypt.org/directory / # letsencrypt API
出现如下提示后,前往域名解析管理后台新增TXT解析
添加记录
添加后不要马上回车继续,等待解析生效
检查解析
# macOS
nslookup -type=txt _acme-challenge.ionantha.tech
- 出现匹配的提示后继续,申请成功
证书存储在/etc/letsencrypt/live/example.com
设置自动续签
# 通用
sudo certbot renew
# 强制续签
sudo certbot renew --dry-run
删除证书
cerbot delete
cerbot delete
输入对应数字即可删除