Let’s Encrypt和Certbot的使用


Let’s Encrypt是免费颁发TLS证书的机构(CA)。支持使用 ACME 协议 的软件获取证书。

Certbot是Let’s Encrypt推荐的ACME客户端。

安装Certbot

安装Python

# Debian,Ubuntu
apt update
apt install python3 python3-venv libaugeas0

# Fedora,CentOS
dnf install python3 augeas-libs

设置Python虚拟环境

python3 -m venv /opt/certbot/
/opt/certbot/bin/pip install --upgrade pip

安装Certbot

/opt/certbot/bin/pip install certbot certbot-nginx
ln -s /opt/certbot/bin/certbot /usr/bin/certbot

配置Nginx

certbot --nginx

设置自动更新

echo "0 0,12 * * * root /opt/certbot/bin/python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew -q" | tee -a /etc/crontab > /dev/null

测试

certbot renew --dry-run

手动更新

certbot certonly --manual

添加域名

certbot --expand -d baidu.com,www.baidu.com

参考:


发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注