Nginx使用Certbot自动获取、更新SSL证书
环境信息
CentOS 7
Nginx
安装Certbot
yum install epel-release -y
yum install snapd -y
systemctl enable --now snapd
ln -s /var/lib/snapd/snap /snap
# 删除其它版本,避免冲突;如果有的话
yum remove certbot
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot
错误处理
执行snap install --classic certbot时报错
error: cannot install "certbot": classic confinement requires snaps under /snap or symlink from
/snap to /var/lib/snapd/snap# 将目录软链接到/目录下即可
ln -s /var/lib/snapd/snap /snap使用
通过certbot申请、更新证书有两种操作方法,一种是直接让certbot管理nginx配置。一种是只获取证书信息,手动修改nginx配置
让certbot自动管理nginx配置文件
certbot --nginx只获取证书,手动管理nginx配置文件
certbot certonly --nginx最后更新于