MENU

CertBot自动签发SSL证书

December 25, 2025 • Linux运维工作

1.安装CertBot

Ubuntu系统安装

sudo apt install -y certbot
sudo apt install -y python3-certbot-nginx

CentOS系统通过安装pip安装

yum -y install python3 python-devel augeas-devel gcc
pip install certbot certbot-nginx

2.申请证书

sudo certbot --nginx -d 你的域名 -d xxx.com -d aaa.com
(注意:--nginx会基于直接主机安装的nginx,读取nginx目录/etc/nginx配置文件,生成前端校验文件获取证书,需要80端口打开,通过80校验文件)

3.设置自动续期

sudo crontab -e
0 0 1 sudo certbot renew --quiet