ssl证书之certbot

一.安装

1.下载压缩包:
#wget https://github.com/certbot/certbot/archive/master.zip

2.解压包

3.官方文档
https://github.com/certbot/certbot

二.创建证书

创建的证书有90天的有效期,过期后需要续期

1.创建单个证书
./certbot-auto certonly --webroot -w 网站目录 -d 域名

2.创建多个证书
./certbot-auto certonly --webroot -w 网站目录1 -d 域名1 -w 网站目录2 -d 域名2


ps:
如果出现超时,可以再次执行命令

三.使用(nginx示例)

在server段配置:
ssl on;
ssl_certificate "/etc/letsencrypt/live/domain.com/fullchain.pem"; #请根据实际路径
ssl_certificate_key "/etc/letsencrypt/live/domain.com/privkey.pem"; #请根据实际路径

四.常用命令

1.查看证书
./certbot-auto certificates

2.续期(更新证书)
#模拟更新证书
./certbot-auto renew --dry-run
#实际更新证书
./certbot-auto renew

3.吊销证书
./certbot-auto revoke --cert-path /etc/letsencrypt/live/domain.com/fullchain.pem

猜你喜欢

转载自www.cnblogs.com/itfenqing/p/10333399.html