{"id":598,"date":"2023-06-05T12:37:10","date_gmt":"2023-06-05T04:37:10","guid":{"rendered":"https:\/\/por.tw\/linux\/?p=598"},"modified":"2020-11-01T02:22:31","modified_gmt":"2020-10-31T18:22:31","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8debian-9%e4%b8%8a-%e5%ae%89%e8%a3%9d-lets-encrypt-ssl%e5%ae%89%e5%85%a8%e6%86%91%e8%ad%89%e5%8a%a0%e5%af%86","status":"publish","type":"post","link":"https:\/\/por.tw\/linux\/%e5%a6%82%e4%bd%95%e5%9c%a8debian-9%e4%b8%8a-%e5%ae%89%e8%a3%9d-lets-encrypt-ssl%e5%ae%89%e5%85%a8%e6%86%91%e8%ad%89%e5%8a%a0%e5%af%86\/","title":{"rendered":"\u5982\u4f55\u5728Debian 9\u4e0a \u5b89\u88dd Let&#8217;s Encrypt SSl\u5b89\u5168\u6191\u8b49\u52a0\u5bc6"},"content":{"rendered":"<p><span style=\"font-size: 16px;\"><strong>\u5728\u672c\u6559\u5b78\u4e2d\uff0c\u60a8\u5c07\u5b78\u7fd2\u5728\u904b\u884cDebian 9 Stretch\u7684Apache Web\u4f3a\u670d\u5668\u4e0a\u5b89\u88ddTLS \/ SSL\u8b49\u66f8\u7684\u904e\u7a0b\u3002<\/strong><\/span><br \/>\n<span style=\"font-size: 16px;\"><strong>\u5b8c\u6210\u5f8c\uff0c\u4f3a\u670d\u5668\u8207\u7528\u6236\u7aef\u4e4b\u9593\u7684\u6240\u6709\u6d41\u91cf\u90fd\u5c07\u88ab\u52a0\u5bc6\u4e14\u5b89\u5168\u3002<\/strong><\/span><br \/>\n<span style=\"font-size: 16px;\"><strong>\u9019\u662f\u4fdd\u8b77\u96fb\u5b50\u5546\u52d9\u7db2\u7ad9\u548c\u5176\u4ed6\u7dda\u4e0a\u91d1\u878d\u670d\u52d9\u5b89\u5168\u7684\u6a19\u6e96\u505a\u6cd5\u3002<\/strong><\/span><\/p>\n<p><span style=\"font-size: 16px;\"><strong>\u5148\u6c7a\u689d\u4ef6\uff1a<\/strong><\/span><br \/>\n<span style=\"font-size: 16px;\"><strong>\u5728\u958b\u59cb\u4f7f\u7528\u672c\u6307\u5357\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u5177\u5099\u4ee5\u4e0b\u689d\u4ef6\uff1a<\/strong><\/span><\/p>\n<p><span style=\"font-size: 16px;\"><strong>\u5177\u6709root\u8a2a\u554f\u6b0a\u9650\u6216sudo\u4f7f\u7528\u8005\u8a2a\u554fDebian 9 Stretch VPS\u7684 SSH<\/strong><\/span><br \/>\n<span style=\"font-size: 16px;\"><strong>\u6b63\u78ba\u914d\u7f6e\u4e86\u529f\u80fd\u8b8a\u6578\u548c\u865b\u64ec\u4e3b\u6a5f\u7684Apache Web\u4f3a\u670d\u5668<\/strong><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/visdacom.com\/linux\/wp-content\/uploads\/2020\/05\/Debian-9-Lets-Encrypt-SSL.png\" alt=\"\" class=\"alignnone size-full wp-image-601\" width=\"640\" height=\"359\" srcset=\"https:\/\/por.tw\/linux\/wp-content\/uploads\/2020\/05\/Debian-9-Lets-Encrypt-SSL.png 640w, https:\/\/por.tw\/linux\/wp-content\/uploads\/2020\/05\/Debian-9-Lets-Encrypt-SSL-262x147.png 262w, https:\/\/por.tw\/linux\/wp-content\/uploads\/2020\/05\/Debian-9-Lets-Encrypt-SSL-321x180.png 321w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><br \/>\n<span style=\"font-size: 16px;\"><strong>\u6b65\u9a5f1\uff1a\u5b89\u88ddLet&#8217;sEncrypt certbot<\/strong><\/span><br \/>\n<span style=\"font-size: 16px;\"><strong>\u4f7f\u7528\u201c\u8b93\u6211\u5011\u52a0\u5bc6\u201d\u53d6\u5f97SSL\u8b49\u66f8\u7684\u7b2c\u4e00\u6b65\u662f\u5728\u4f3a\u670d\u5668\u4e0a\u5b89\u88ddcertbot\u201c\u8b93\u6211\u5011\u52a0\u5bc6\u201d\u7528\u6236\u7aef\u3002\u8981\u5b89\u88dd\uff0c\u8acb\u904b\u884c\u4ee5\u4e0b\u6307\u4ee4\uff1a<br \/>\n<\/strong><\/span><\/p>\n<pre class=\"language-markup\"><code>sudo apt-get install certbot<\/code><\/pre>\n<p><span style=\"font-size: 16px;\"><strong>\u6b65\u9a5f2\uff1a\u5efa\u7acb\u4e26\u5b89\u88ddSSL\u8b49\u66f8\uff09<br \/>\n\u4f7f\u7528\u201c\u8b93\u6211\u5011\u52a0\u5bc6\u201d\u7528\u6236\u7aef\u70baApache\u751f\u6210SSL\u8b49\u66f8\u975e\u5e38\u7c21\u55ae\u3002<br \/>\n\u7528\u6236\u7aef\u5c07\u81ea\u52d5\u53d6\u5f97\u4e26\u5b89\u88dd\u5c0d\u6211\u5011\u7684Apache\u914d\u7f6e\u4e2d\u7684\u529f\u80fd\u8b8a\u6578\u6709\u6548\u7684\u65b0SSL\u8b49\u66f8\u3002\u8981\u57f7\u884c\u4ea4\u8ac7\u5f0f\u5b89\u88dd\u4e26\u53d6\u5f97Apache\u914d\u7f6e\u4e2d\u5b9a\u7fa9\u7684\u6240\u6709\u529f\u80fd\u8b8a\u6578\u7684\u8b49\u66f8\uff0c\u8acb\u8f38\u5165\uff1a<br \/>\n<\/strong><\/span><\/p>\n<pre class=\"language-markup\"><code>sudo certbot --Apache<\/code><\/pre>\n<p><span style=\"font-size: 16px;\"><strong> \u6b65\u9a5f3\uff1a\u6aa2\u67e5SSL\u8b49\u66f8\u7684\u914d\u7f6e<br \/>\n\u5728\u4e0a\u8ff0\u968e\u6bb5\uff0c\u5c07\u5275\u5efa\u4e26\u914d\u7f6e\u8b49\u66f8\u3002\u73fe\u5728\u6aa2\u67e5\u60a8\u7684\u57dfVirtualHost\u8207ssl\u7684\u914d\u7f6e\u662f\u5426\u985e\u4f3c\u3002\u5982\u679c\u6c92\u6709\uff0c\u90a3\u9ebc\u5c07\u5b83\u5011\u624b\u52d5\u653e\u5728virtualhost\u7684ssl\u914d\u7f6e\u4e0a\uff1a<br \/>\n<\/strong><\/span><\/p>\n<pre class=\"language-markup\"><code>...\nSSLCertificateFile \/ etc \/ letsencrypt \/ live \/ &lt;\u60a8\u7684\u7db2\u57df&gt; \/cert.pem\nSSLCertificateKeyFile \/ etc \/ letsencrypt \/ live \/ &lt;\u60a8\u7684\u7db2\u57df&gt; \/privkey.pem\nSSLCertificateChainFile \/ etc \/ letsencrypt \/ live \/ &lt;\u60a8\u7684\u7db2\u57df&gt; \/chain.pem\n...<\/code><\/pre>\n<p><span style=\"font-size: 16px;\"><strong>\u73fe\u5728\uff0c\u9700\u8981\u6e2c\u8a66\u6211\u5011\u7684\u914d\u7f6e\u662f\u5426\u6b63\u78ba\u2013<br \/>\n<\/strong><\/span><\/p>\n<pre class=\"language-markup\"><code>sudo apachectl configtest<\/code><\/pre>\n<p><span style=\"font-size: 16px;\"><strong>\u6700\u5f8c\uff0c\u91cd\u65b0\u555f\u52d5 apache\uff0c\u60a8\u7684SSL\u61c9\u8a72\u7acb\u5373\u958b\u59cb\u5de5\u4f5c\u3002<br \/>\n<\/strong><\/span><\/p>\n<pre class=\"language-markup\"><code>sudo service apache2 reload<\/code><\/pre>\n<p><span style=\"font-size: 16px;\"><strong>\u6b65\u9a5f4\uff1a\u8a2d\u5b9a\u81ea\u52d5\u7e8c\u7d04<br \/>\n\u7cfb\u7d71\u4e0a\u7684Certbot\u8edf\u9ad4\u5305\u5e36\u6709cronjob\uff0c\u5b83\u5c07\u5728\u8b49\u66f8\u904e\u671f\u4e4b\u524d\u81ea\u52d5\u66f4\u65b0\u8b49\u66f8\u3002<br \/>\n\u7531\u65bc\u201c\u8b93\u6211\u5011\u52a0\u5bc6\u201d\u8b49\u66f8\u53ef\u4ee5\u4f7f\u752890\u5929\uff0c\u56e0\u6b64\uff0c\u6700\u597d\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u60a8\u53ef\u4ee5\u901a\u904e\u904b\u884c\u4ee5\u4e0b\u6307\u4ee4\u4f86\u6e2c\u8a66\u8b49\u66f8\u7684\u81ea\u52d5\u7e8c\u8a02\uff1a<br \/>\n<\/strong><\/span><\/p>\n<pre class=\"language-markup\"><code>sudo certbot renew --dry-run<\/code><\/pre>\n<p><span style=\"font-size: 16px;\"><strong>\u7d50\u8ad6\uff1a<br \/>\n\u60a8\u525b\u525b\u901a\u904e\u5be6\u65bd\u6700\u53d7\u671f\u5f85\u7684\u5b89\u5168\u529f\u80fd-\u514d\u8cbb\u7684SSL\u8b49\u66f8\u4f86\u4fdd\u8b77apache Web\u4f3a\u670d\u5668\uff01<br \/>\n\u5f9e\u73fe\u5728\u958b\u59cb\uff0c\u529f\u80fd\u8b8a\u6578Web\u4f3a\u670d\u5668\u548c\u7528\u6236\u7aef\u4e4b\u9593\u7684\u6240\u6709\u6d41\u91cf\u90fd\u662f\u5b89\u5168\u7684\uff0c\u53ef\u4ee5\u78ba\u4fdd\u6c92\u6709\u4eba\u53ef\u4ee5\u6514\u622a\u901a\u4fe1\u4e26\u8b8a\u66f4\u6216\u7aca\u53d6\u91cd\u8981\u8a0a\u606f\u3002<\/strong><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u672c\u6559\u5b78\u4e2d\uff0c\u60a8\u5c07\u5b78\u7fd2\u5728\u904b\u884cDebian 9 Stretch\u7684Apache Web\u4f3a\u670d\u5668\u4e0a\u5b89\u88ddTLS \/ SSL [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":601,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[20],"class_list":["post-598","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-linux"],"_links":{"self":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts\/598"}],"collection":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/comments?post=598"}],"version-history":[{"count":0,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts\/598\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/media\/601"}],"wp:attachment":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/media?parent=598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/categories?post=598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/tags?post=598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}