{"id":2019,"date":"2020-07-17T09:18:13","date_gmt":"2020-07-17T07:18:13","guid":{"rendered":"https:\/\/blog.kodono.info\/wordpress\/?p=2019"},"modified":"2020-07-17T09:18:13","modified_gmt":"2020-07-17T07:18:13","slug":"lets-encrypt-certificate-how-to-remove-a-domain-from-a-certname-that-contains-several-domains","status":"publish","type":"post","link":"https:\/\/blog.kodono.info\/wordpress\/2020\/07\/17\/lets-encrypt-certificate-how-to-remove-a-domain-from-a-certname-that-contains-several-domains\/","title":{"rendered":"Let&#8217;s Encrypt Certificate: how to remove a domain from a certname that contains several domains"},"content":{"rendered":"<p>My server manages several websites with different domains using Apache. The first time I used Let&#8217;s Encrypt I followed the default command which has created one certname for ALL my domains.<\/p>\n<p>Now I want to remove just one domain from this certificate, and it becomes complicated to understand how to do it. The best solution is to create a new certificate for each of my domains, and then to delete the original certname.<\/p>\n<p>Let&#8217;s say my certname is called <code>www.example.com<\/code> and it contains the below domains:<\/p>\n<ul>\n<li>www.example.com<\/li>\n<li>example.com<\/li>\n<li>blog.example.com<\/li>\n<li>other-example.com<\/li>\n<li>www.other-example.com<\/li>\n<li>my-other-domain.com<\/li>\n<li>www.my-other-domain.com<\/li>\n<li>api.test.com<\/li>\n<\/ul>\n<p>The one I don&#8217;t need anymore is <code>*.my-other-domain.com<\/code>.<\/p>\n<p>First, we create a certificate individually for each domain that we want to keep:<\/p>\n<pre class=\"brush:python\">\r\ncertbot --apache --cert-name example.com -d example.com,www.example.com,blog.example.com\r\ncertbot --apache --cert-name other-example.com -d other-example.com,www.other-example.com\r\ncertbot --apache --cert-name test.com -d api.test.com\r\n<\/pre>\n<p><code>--cert-name<\/code> permits to give our own name to the certificate, and <code>-d<\/code> indicates which domains should be added to this certificate.<\/p>\n<p>Then we can list all our certificates:<\/p>\n<pre class=\"brush:bash\">\r\ncertbot certificates\r\n<\/pre>\n<p>Using the above command you can find the <code>Certificate Path<\/code> and now we can delete our original certificate:<\/p>\n<pre class=\"brush:bash\">\r\ncertbot revoke --cert-path \/etc\/letsencrypt\/live\/www.example.com\/fullchain.pem\r\n<\/pre>\n<p>You&#8217;re all set! All your domains should still have a correct certificate, and you revoked the ones you don&#8217;t need anymore.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My server manages several websites with different domains using Apache. The first time I used Let&#8217;s Encrypt I followed the default command which has created one certname for ALL my domains. Now I want to remove just one domain from this certificate, and it becomes complicated to understand how to do it. The best solution [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","hide_page_title":"","footnotes":""},"categories":[15,170,20],"tags":[153,123,155,173],"class_list":["post-2019","post","type-post","status-publish","format-standard","hentry","category-astuce","category-english","category-niveau-expert","tag-astuce","tag-english","tag-niveau-expert","tag-ssl"],"_links":{"self":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/2019","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/comments?post=2019"}],"version-history":[{"count":6,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/2019\/revisions"}],"predecessor-version":[{"id":2025,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/2019\/revisions\/2025"}],"wp:attachment":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/media?parent=2019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/categories?post=2019"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/tags?post=2019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}