大网数据广告活动
服务器运维问答

How to totally remove a certbot-created SSL certificate?

· 52CE 我爱测

I use Ubuntu 16.04 with Nginx and I've installed Nginx Certbot on my operating system (Ubuntu 16.04) with: apt-get update -y add-apt-repository ppa:certbot/certbot -y apt-get update -y apt-get upgrade python-certbot-nginx -y I se…

问题原文

原帖链接 · Arcticooling · CC BY-SA 3.0

I use Ubuntu 16.04 with Nginx and I've installed Nginx Certbot on my operating system (Ubuntu 16.04) with:

apt-get update -y
add-apt-repository ppa:certbot/certbot -y
apt-get update -y
apt-get upgrade python-certbot-nginx -y

I setted Nginx variables:

s_a="/etc/nginx/sites-available"
s_e="/etc/nginx/sites-available"

I created an app conf based on these variables:

sed "s/\${domain}/${1}/g" "~/${repo}/template_nginx_app" > "${s_a}/${domain}.conf"
ln -sf ${s_a}/${domain}.conf ${s_e}

I created a correspondent SSL certificate with Certbot based on the app conf, this way:

certbot --nginx -d ${domain} -d www.${domain}

There are cases an SSL certificate is created in a bad way and one just need to start over after some configurations.

How could I totally remove the SSL certificate (besides removing the app conf ${domain}.conf which was also edited/reconfigured by Certbot) ?

Is there a fast way to do that directly from Certbot? My desire is that no remnants whatsoever would left for both app conf and certificate.

This might be the good way:

rm ${s_a}/${domain}.conf && rm ${s_e}/${domain}.conf
rm -rf /etc/letsencrypt/{live,renewal,archive}/{${DOMAIN},${DOMAIN}.conf}

社区高分解答

原帖链接 · Paul John Leonard · CC BY-SA 4.0

If you are running apache2 you will also want to remove the certbot references from the conf file otherwise certbot will get confused when you add a new certificate.

sudo certbot delete

then

emacs /etc/apache2/sites-enabled/000-default-le-ssl.conf 

Remove these lines

Include /etc/letsencrypt/options-ssl-apache.conf 
ServerName example.com 
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem 
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-02-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。