use*_*858 12 ssl configuration nginx bash certbot
我将 Ubuntu 16.04 与 Nginx 一起使用,并且我已经在我的操作系统(Ubuntu 16.04)上安装了 Nginx Certbot:
apt-get update -y
add-apt-repository ppa:certbot/certbot -y
apt-get update -y
apt-get upgrade python-certbot-nginx -y
Run Code Online (Sandbox Code Playgroud)
我设置了 Nginx 变量:
s_a="/etc/nginx/sites-available"
s_e="/etc/nginx/sites-available"
Run Code Online (Sandbox Code Playgroud)
我根据这些变量创建了一个应用程序配置:
sed "s/\${domain}/${1}/g" "~/${repo}/template_nginx_app" > "${s_a}/${domain}.conf"
ln -sf ${s_a}/${domain}.conf ${s_e}
Run Code Online (Sandbox Code Playgroud)
我基于 app conf 用 Certbot 创建了一个对应的 SSL 证书,这样:
certbot --nginx -d ${domain} -d www.${domain}
Run Code Online (Sandbox Code Playgroud)
在某些情况下,SSL 证书的创建方式不正确,只需在进行一些配置后重新开始即可。
我怎样才能完全删除 SSL 证书(除了删除${domain}.conf也由 Certbot 编辑/重新配置的应用程序配置)?
有没有直接从 Certbot 执行此操作的快速方法?我的愿望是应用程序配置文件和证书都不会留下任何残留物。
这可能是个好方法:
rm ${s_a}/${domain}.conf && rm ${s_e}/${domain}.conf
rm -rf /etc/letsencrypt/{live,renewal,archive}/{${DOMAIN},${DOMAIN}.conf}
Run Code Online (Sandbox Code Playgroud)
小智 27
是的,certbot 可以帮你清理。
sudo certbot certificates
将列出 certbot 认为您已安装的内容
sudo certbot delete
将允许您以交互方式删除和清理不需要的/已弃用的域。
小智 13
获取要删除的证书名称
sudo certbot certificates
Run Code Online (Sandbox Code Playgroud)
按名称仅删除一张证书
sudo certbot delete --cert-name server.domain.tld
Run Code Online (Sandbox Code Playgroud)
小智 5
如果您运行的是 apache2,您还需要从 conf 文件中删除 certbot 引用,否则当您添加新证书时 certbot 会感到困惑。
sudo certbot delete
Run Code Online (Sandbox Code Playgroud)
然后
emacs /etc/apache2/sites-enabled/000-default-le-ssl.conf
Run Code Online (Sandbox Code Playgroud)
删除这些行
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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21594 次 |
| 最近记录: |