{"id":737,"date":"2021-11-25T17:08:13","date_gmt":"2021-11-25T09:08:13","guid":{"rendered":"https:\/\/blog.nami.idv.tw\/?p=737"},"modified":"2021-11-25T17:08:13","modified_gmt":"2021-11-25T09:08:13","slug":"%e5%9c%a8-linux-ubuntu-%e5%b0%8e%e5%85%a5-lets-encrypt-snap-%e7%89%88for-apache","status":"publish","type":"post","link":"https:\/\/blog.nami.idv.tw\/?p=737","title":{"rendered":"\u5728 Linux (Ubuntu) \u5c0e\u5165 Let\u2019s Encrypt (snap \u7248)(for Apache)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>\u6587\u7ae0\u66f4\u65b0\u6642\u9593\uff1a2021-11-<\/em>25<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u74b0\u5883\uff1a<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">OS: Ubuntu 18.04 LTS<br>Web server: Apache: 2.4<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u521d\u59cb\u5316\uff1a<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b89\u88dd\u6d41\u7a0b\u53c3\u95b1\u5b98\u65b9\u5167\u5bb9\u5373\u53ef\uff1a<a href=\"https:\/\/certbot.eff.org\/instructions?ws=apache&amp;os=ubuntu-18\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/certbot.eff.org\/instructions?ws=apache&amp;os=ubuntu-18<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u55ae\u4e00\u4e3b\u6a5f\u540d\u7a31 (Single host) \u6b65\u9a5f\uff1a<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>\u958b\u59cb\u81ea\u52d5\u5316\u8a2d\u5b9a (for apache) .\/certbot --apache<\/li><li>\u9078\u64c7\u8981\u7c3d\u767c\u6191\u8b49\u7684\u4e3b\u6a5f\u540d\u7a31<\/li><li>\u9078\u64c7\u672a\u4f86\u7684\u9023\u7dda\u65b9\u5f0f<ol><li>HTTP, HTTPS \u4e26\u5b58<\/li><li>\u5168\u90e8\u5c0e\u5411 HTTPS (\u6703\u81ea\u52d5\u5728\u8a72\u4e3b\u6a5f\u8a2d\u5b9a\u6a94\u52a0\u4e0a rewrite rule)<\/li><\/ol><\/li><li>\u6e2c\u8a66\u662f\u5426\u6b63\u5e38\u7c3d\u767c https:\/\/www.ssllabs.com\/ssltest\/analyze.html?d=[\u4e3b\u6a5f\u540d\u7a31]<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Wildcard Certificate \u6b65\u9a5f\uff1a<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>\u63a1\u7528\u624b\u52d5\u8a2d\u5b9a\uff0c\u6311\u6230\u6a21\u5f0f\u63a1\u7528 DNS TXT \u7d00\u9304: .\/certbot certonly --manual --preferred-challenges dns --agree-tos --email yourname@example.com -d \"*.yourdomain.com,yourdomain.com\"<\/li><li>\u63a5\u4e0b\u4f86\u6703\u51fa\u73fe\u8981\u52a0\u5165 DNS TXT \u7684\u5167\u5bb9: <a href=\"https:\/\/blog.nami.idv.tw\/wp-content\/uploads\/2016\/05\/Screenshot.png\"><\/a><\/li><li>\u52a0\u5165\u5f8c\u7528\u4ee5\u4e0b\u6307\u4ee4\u78ba\u8a8d\u662f\u5426\u5df2\u7d93\u751f\u6548: <br>[Linux] dig _acme-challenge.yourdomain.com txt <br>[Windows] nslookup -q=txt _acme-challenge.yourdomain.com<\/li><li>\u751f\u6548\u5f8c\u6309\u4e0b Enter<\/li><li>\u7531\u65bc\u672c\u7bc4\u4f8b\u767b\u9304\u4e86 *.yourdomain.com \u53ca yourdomain.com \u5169\u500b\u57df\u540d\uff0c\u6240\u4ee5 2~3 \u6b65\u9a5f\u6703\u8dd1\u5169\u6b21\uff08\u8acb\u6ce8\u610f\u90a3\u500b\u6311\u6230\u7528\u7684\u503c xxxxxxxx \u6bcf\u6b21\u90fd\u4e0d\u540c\uff0c\u6b64\u5916\uff0c\u4e0d\u8981\u522a\u9664\u524d\u4e00\u500b TXT Record \u800c\u662f\u5efa\u7acb\u540c\u540d\u7684\u7b2c\u4e8c\u500b TXT Record\uff09<\/li><li>\u7b49\u7b2c\u4e8c\u500b\u751f\u6548\u7b49\u4e86\u4e00\u6bb5\u6642\u9593\uff0c\u56e0\u70ba\u8981\u770b\u4e3b\u6a5f\u7684 TTL<\/li><li>\u4ee5\u5f8c\u9084\u662f\u5f97\u4f7f\u7528\u4ee5\u4e0a\u76f8\u540c\u6d41\u7a0b\u4f86\u66f4\u65b0\u6191\u8b49<\/li><li>\u7531\u65bc\u6b64\u65b9\u5f0f<strong>\u50c5\u7533\u8acb\u6191\u8b49<\/strong>\u4f46\u6c92\u6709\u81ea\u52d5\u8a2d\u5b9a\u5230 Web Server\uff0c\u6240\u4ee5\u5f8c\u7e8c\u8981\u81ea\u5df1\u624b\u52d5\u8a2d\u5b9a<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u7dad\u8b77\uff1a<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5217\u51fa\u6240\u6709\u6191\u8b49: .\/certbot certificates<\/li><li>\u66f4\u65b0\u6240\u6709\u6191\u8b49: .\/certbot renew<\/li><li>\u66f4\u65b0\u55ae\u4e00\u6191\u8b49: .\/certbot renew --cert-name [\u6191\u8b49\u540d\u7a31]<\/li><li>\u522a\u9664\u6191\u8b49: .\/certbot delete --cert-name [\u6191\u8b49\u540d\u7a31]<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Reference:<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/certbot.eff.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/certbot.eff.org\/<\/a><\/li><li><a href=\"https:\/\/eff-certbot.readthedocs.io\/en\/stable\/using.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/eff-certbot.readthedocs.io\/en\/stable\/using.html<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u66f4\u65b0\u6642\u9593\uff1a2021-11-25 \u74b0\u5883\uff1a OS: Ubuntu 18.04 L &hellip; <a href=\"https:\/\/blog.nami.idv.tw\/?p=737\">\u95b1\u8b80\u5168\u6587 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-737","post","type-post","status-publish","format-standard","hentry","category-misc"],"_links":{"self":[{"href":"https:\/\/blog.nami.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nami.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nami.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nami.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nami.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=737"}],"version-history":[{"count":2,"href":"https:\/\/blog.nami.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/737\/revisions"}],"predecessor-version":[{"id":739,"href":"https:\/\/blog.nami.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/737\/revisions\/739"}],"wp:attachment":[{"href":"https:\/\/blog.nami.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nami.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nami.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}