{"id":230076,"date":"2023-12-25T14:30:21","date_gmt":"2023-12-25T06:30:21","guid":{"rendered":"https:\/\/www.idc.net\/help\/230076\/"},"modified":"2023-12-25T14:30:21","modified_gmt":"2023-12-25T06:30:21","slug":"apache%e6%96%b0%e6%89%8b%e6%95%99%e7%a8%8b%ef%bc%9a%e4%bd%bf%e7%94%a8lets-encrypt%e4%bf%9d%e6%8a%a4apache","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/230076\/","title":{"rendered":"Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528Let&#8217;s Encrypt\u4fdd\u62a4Apache"},"content":{"rendered":"<p><title id=\"apache%e6%96%b0%e6%89%8b%e6%95%99%e7%a8%8b%ef%bc%9a%e4%bd%bf%e7%94%a8lets-encrypt%e4%bf%9d%e6%8a%a4apache-JrIhUABtwx\">Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528Let's Encrypt\u4fdd\u62a4Apache<\/title><\/p>\n<h1 id=\"apache%e6%96%b0%e6%89%8b%e6%95%99%e7%a8%8b%ef%bc%9a%e4%bd%bf%e7%94%a8lets-encrypt%e4%bf%9d%e6%8a%a4apache-JrIhUABtwx\">Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528Let's Encrypt\u4fdd\u62a4Apache<\/h1>\n<h2 id=\"%e4%bb%8b%e7%bb%8d-JrIhUABtwx\">\u4ecb\u7ecd<\/h2>\n<p>Apache\u662f\u4e00\u79cd\u6d41\u884c\u7684\u5f00\u6e90Web\u670d\u52a1\u5668\u8f6f\u4ef6\uff0c\u7528\u4e8e\u5728\u4e92\u8054\u7f51\u4e0a\u6258\u7ba1\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\u3002\u4fdd\u62a4Apache\u670d\u52a1\u5668\u7684\u5b89\u5168\u6027\u81f3\u5173\u91cd\u8981\uff0c\u5176\u4e2d\u4e00\u4e2a\u91cd\u8981\u7684\u65b9\u9762\u662f\u4f7f\u7528SSL\u8bc1\u4e66\u6765\u52a0\u5bc6\u4f20\u8f93\u7684\u6570\u636e\u3002Let's Encrypt\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u8bc1\u4e66\u9881\u53d1\u673a\u6784\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u83b7\u5f97\u548c\u7ba1\u7406SSL\u8bc1\u4e66\u3002<\/p>\n<h2 id=\"%e6%ad%a5%e9%aa%a41%ef%bc%9a%e5%ae%89%e8%a3%85certbot-JrIhUABtwx\">\u6b65\u9aa41\uff1a\u5b89\u88c5Certbot<\/h2>\n<p>\u8981\u4f7f\u7528Let's Encrypt\u8bc1\u4e66\uff0c\u60a8\u9700\u8981\u5b89\u88c5Certbot\u5de5\u5177\u3002Certbot\u662f\u4e00\u4e2a\u81ea\u52a8\u5316\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u83b7\u53d6\u548c\u5b89\u88c5SSL\u8bc1\u4e66\u3002<\/p>\n<p>\u5728Ubuntu\u7cfb\u7edf\u4e0a\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Certbot\uff1a<\/p>\n<pre><code>sudo apt-get update\nsudo apt-get install certbot<\/code><\/pre>\n<h2 id=\"%e6%ad%a5%e9%aa%a42%ef%bc%9a%e8%8e%b7%e5%8f%96ssl%e8%af%81%e4%b9%a6-JrIhUABtwx\">\u6b65\u9aa42\uff1a\u83b7\u53d6SSL\u8bc1\u4e66<\/h2>\n<p>\u4e00\u65e6Certbot\u5b89\u88c5\u5b8c\u6210\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u83b7\u53d6SSL\u8bc1\u4e66\uff1a<\/p>\n<pre><code>sudo certbot certonly --apache<\/code><\/pre>\n<p>\u8fd9\u5c06\u542f\u52a8Certbot\u5e76\u81ea\u52a8\u68c0\u6d4b\u60a8\u7684Apache\u914d\u7f6e\uff0c\u5e76\u4e3a\u60a8\u7684\u57df\u540d\u751f\u6210SSL\u8bc1\u4e66\u3002<\/p>\n<h2 id=\"%e6%ad%a5%e9%aa%a43%ef%bc%9a%e9%85%8d%e7%bd%aeapache-JrIhUABtwx\">\u6b65\u9aa43\uff1a\u914d\u7f6eApache<\/h2>\n<p>\u4e00\u65e6\u60a8\u83b7\u5f97\u4e86SSL\u8bc1\u4e66\uff0c\u60a8\u9700\u8981\u914d\u7f6eApache\u4ee5\u4f7f\u7528\u5b83\u3002\u6253\u5f00Apache\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre><code>SSLCertificateFile \/etc\/letsencrypt\/live\/your_domain_name\/fullchain.pem\nSSLCertificateKeyFile \/etc\/letsencrypt\/live\/your_domain_name\/privkey.pem<\/code><\/pre>\n<p>\u8bf7\u5c06\"your_domain_name\"\u66ff\u6362\u4e3a\u60a8\u81ea\u5df1\u7684\u57df\u540d\u3002<\/p>\n<h2 id=\"%e6%ad%a5%e9%aa%a44%ef%bc%9a%e9%87%8d%e5%90%afapache-JrIhUABtwx\">\u6b65\u9aa44\uff1a\u91cd\u542fApache<\/h2>\n<p>\u5b8c\u6210\u914d\u7f6e\u540e\uff0c\u60a8\u9700\u8981\u91cd\u542fApache\u670d\u52a1\u5668\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u542fApache\uff1a<\/p>\n<pre><code>sudo service apache2 restart<\/code><\/pre>\n<h2 id=\"%e6%ad%a5%e9%aa%a45%ef%bc%9a%e8%87%aa%e5%8a%a8%e6%9b%b4%e6%96%b0%e8%af%81%e4%b9%a6-JrIhUABtwx\">\u6b65\u9aa45\uff1a\u81ea\u52a8\u66f4\u65b0\u8bc1\u4e66<\/h2>\n<p>Let's Encrypt\u8bc1\u4e66\u7684\u6709\u6548\u671f\u4e3a90\u5929\u3002\u4e3a\u4e86\u786e\u4fdd\u60a8\u7684\u8bc1\u4e66\u59cb\u7ec8\u6709\u6548\uff0c\u60a8\u53ef\u4ee5\u8bbe\u7f6e\u81ea\u52a8\u66f4\u65b0\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6dfb\u52a0\u4e00\u4e2acron\u4f5c\u4e1a\uff1a<\/p>\n<pre><code>sudo crontab -e<\/code><\/pre>\n<p>\u5728cron\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre><code>30 2 * * 1 certbot renew --quiet<\/code><\/pre>\n<p>\u8fd9\u5c06\u5728\u6bcf\u5468\u4e00\u7684\u51cc\u66682:30\u81ea\u52a8\u66f4\u65b0\u8bc1\u4e66\u3002<\/p>\n<h2 id=\"%e6%80%bb%e7%bb%93-JrIhUABtwx\">\u603b\u7ed3<\/h2>\n<p>\u901a\u8fc7\u4f7f\u7528Let's Encrypt\u548cCertbot\uff0c\u60a8\u53ef\u4ee5\u8f7b\u677e\u5730\u4e3a\u60a8\u7684Apache\u670d\u52a1\u5668\u83b7\u53d6\u548c\u7ba1\u7406SSL\u8bc1\u4e66\u3002\u4fdd\u62a4\u60a8\u7684\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\u7684\u5b89\u5168\u6027\u5bf9\u4e8e\u5efa\u7acb\u4fe1\u4efb\u548c\u4fdd\u62a4\u7528\u6237\u6570\u636e\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<h3 id=\"%e9%a6%99%e6%b8%af%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%a6%96%e9%80%89%e5%90%8e%e6%b5%aa%e4%ba%91-JrIhUABtwx\">\u9999\u6e2f\u670d\u52a1\u5668\u9996\u9009\u540e\u6d6a\u4e91<\/h3>\n<p>\u540e\u6d6a\u4e91\u662f\u4e00\u5bb6\u63d0\u4f9b\u9999\u6e2f\u670d\u52a1\u5668\u3001\u7f8e\u56fd\u670d\u52a1\u5668\u548c\u4e91\u670d\u52a1\u5668\u7684\u4e91\u8ba1\u7b97\u516c\u53f8\u3002\u4ed6\u4eec\u63d0\u4f9b\u9ad8\u6027\u80fd\u7684\u670d\u52a1\u5668\u548c\u7075\u6d3b\u7684\u4e91\u8ba1\u7b97\u89e3\u51b3\u65b9\u6848\uff0c\u9002\u7528\u4e8e\u5404\u79cd\u4e1a\u52a1\u9700\u6c42\u3002<\/p>\n<p>\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u540e\u6d6a\u4e91\u7684\u4fe1\u606f\uff0c\u8bf7\u8bbf\u95ee<a href=\"https:\/\/idc.net\">https:\/\/idc.net<\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528Let's Encrypt\u4fdd\u62a4Apache Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528Let's E [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[],"class_list":["post-230076","post","type-post","status-publish","format-standard","hentry","category-apache"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/230076","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=230076"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/230076\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=230076"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=230076"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=230076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}