本章梗概
- Other collections—more complex and interesting ones this time
- The question mark operator—just type ? to handle errors
- When panic and unwrap are good
apt update
apt upgrade
apt install certbot python3-certbot-dns-cloudflare
编辑配置文件
vim /etc/letsencrypt/cloudflare.ini
# Cloudflare API token used by Certbot
dns_cloudflare_api_token = 0123456789abcdef0123456789abcdef01234567
更改权限为只读
chmod 600 /etc/letsencrypt/cloudflare.ini
sudo certbot certonly \
--dns-cloudflare \
--dns-cloudflare-credentials /etc/letsencrypt/cloudflare.ini \
--key-type ecdsa \
-d "shufue.top,*.shufue.top"
Certbot会默认安装证书时创建一个自动续签任务,但我们可以手动确认或者设置续签任务。
certbot renew --dry-run
crontab -e
0 0 * * * certbot renew --quiet --deploy-hook "/usr/bin/systemctl reload nginx"
这个任务会每天运行一次,检查证书是否需要续签。如果需要,它会自动续签,并在完成后重载 Nginx
欢迎使用 WordPress。这是您的第一篇文章。编辑或删除它,然后开始写作吧!