申请单个域名证书
certbot: 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
申请通配符域名证书
阿里云等国内域名商购买域名
申请证书
centOS需要提前安装依赖
pip uninstall requests
pip uninstall urllib3
yum remove python-urllib3
yum remove python-requests
yum install python-urllib3
yum install python-requests
yum install certbot
sudo certbot certonly --manual \ # 通配符模式
-d *.ionantha.tech \ # 个人域名
--email XXX@gmail.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
输入对应数字即可删除