在学习Linux的过程中,难免不犯错误。在Certbot申请证书的过程中,的确有时会犯中二病。

1.首先确认你的证书不再需要,如果有必要,请执行下面的命令进行备份

1
cp /etc/letsencrypt/ /etc/letsencrypt.backup -r

2.撤销证书

进入certbot目录,执行如下命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@rxblog certbot-0.22.2]# ./certbot-auto revoke --cert-path /etc/letsencrypt/archive/iwwenbo.com/cert1.pem
Saving debug log to /var/log/letsencrypt/letsencrypt.log

-------------------------------------------------------------------------------
Would you like to delete the cert(s) you just revoked?
-------------------------------------------------------------------------------
(Y)es (recommended)/(N)o: Y

-------------------------------------------------------------------------------
Deleted all files relating to certificate iwwenbo.com.
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
Congratulations! You have successfully revoked the certificate that was located
at /etc/letsencrypt/archive/iwwenbo.com/cert1.pem

-------------------------------------------------------------------------------

3.删除证书

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@rxblog certbot-0.22.2]# ./certbot-auto delete 
Saving debug log to /var/log/letsencrypt/letsencrypt.log

Which certificate(s) would you like to delete?
-------------------------------------------------------------------------------
1: rxblog.xyz
2: weiyanzixun.com
3: iwwenbo.com
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 3
-------------------------------------------------------------------------------
Deleted all files relating to certificate www.mydomain.com.
-------------------------------------------------------------------------------

选择你要进行删除的域名证书,用英文逗号”,”或者空格进行多个域名的分割;如果取消输入”c”。这样你需要删除的域名相关文件就删除了。