certbot安装教程

Certbot是一个开源免费的工具,主要功能是为网站自动安装基于 Let’s Encrypt服务的SSL证书

开始安装

进入官网后先选择代理服务器类型和系统类型

https://easy.fxx6.top/i/2024/06/05/665009bb06b20.png

选好后安装下方命令依次执行,如果没安装snap,先安装

1
2
3
4
5
## 安装snap,已安装就跳过
sudo apt install snapd

## 安装certbot
sudo snap install --classic certbot

等待命令执行完毕,大概会有4-5分钟左右

1
sudo ln -s /snap/bin/certbot /usr/bin/certbot

安装完毕后就可以使用这个工具申请证书了,如果你是用的nginx会扫描你的.conf文件夹,并列出所有的代理的网站地址

1
sudo certbot --nginx

https://easy.fxx6.top/i/2024/06/05/66500ba21c3d6.png

通过序号选择你想申请的证书并回车,申请成功后就不用管了,该工具会自动帮你续期

通过下面的命令验证自动续期是否正常

1
sudo certbot renew --dry-run
常用命令
1
2
3
4
5
6
7
8
# 申请证书
sudo certbot --nginx

# 列出所有申请过的证书
certbot certificates

# 删除某个证书并取消续期
certbot revoke --cert-name xxx.xxx.com

certbot安装教程
https://blog.fxx6.top/posts/certbot-install/
作者
fxx
发布于
2024年5月24日
许可协议