Remove Domain from Nginx & Certbot

問題描述

之前都沒有思考過要不要移除 Certbot 的 SSL 憑證,因為測試的 domain 比較多了,也有更換 domain 的需求,所以就想說移除掉不用的 domain。

解決方法

ㄧ、移除 Nginx 的設定檔

1
2
3
4
5
6
7
# Remove the domain config files
$ sudo rm /etc/nginx/sites-available/sample.com
$ sudo rm /etc/nginx/sites-enabled/sample.com

# Check valid configurations then reload
$ sudo nginx -t
$ sudo service nginx restart

二、移除 Certbot 的憑證

1
2
3
4
5
# List of certificates
$ sudo certbot certificates

# Remove certificates for a domain
$ sudo certbot delete --cert-name sample.com

參考資料