{"id":232958,"date":"2023-12-25T20:49:24","date_gmt":"2023-12-25T12:49:24","guid":{"rendered":"https:\/\/www.idc.net\/help\/232958\/"},"modified":"2023-12-25T20:49:24","modified_gmt":"2023-12-25T12:49:24","slug":"apache%e5%ae%89%e5%85%a8%e7%ad%96%e7%95%a5%ef%bc%9a%e4%bd%bf%e7%94%a8mod_md%e7%ae%a1%e7%90%86lets-encrypt%e8%af%81%e4%b9%a6","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/232958\/","title":{"rendered":"Apache\u5b89\u5168\u7b56\u7565\uff1a\u4f7f\u7528mod_md\u7ba1\u7406Let&#8217;s Encrypt\u8bc1\u4e66"},"content":{"rendered":"<p><title id=\"apache%e5%ae%89%e5%85%a8%e7%ad%96%e7%95%a5%ef%bc%9a%e4%bd%bf%e7%94%a8mod_md%e7%ae%a1%e7%90%86lets-encrypt%e8%af%81%e4%b9%a6-jDgrYnRLGH\">Apache\u5b89\u5168\u7b56\u7565\uff1a\u4f7f\u7528mod_md\u7ba1\u7406Let's Encrypt\u8bc1\u4e66<\/title><\/p>\n<h1 id=\"apache%e5%ae%89%e5%85%a8%e7%ad%96%e7%95%a5%ef%bc%9a%e4%bd%bf%e7%94%a8mod_md%e7%ae%a1%e7%90%86lets-encrypt%e8%af%81%e4%b9%a6-jDgrYnRLGH\">Apache\u5b89\u5168\u7b56\u7565\uff1a\u4f7f\u7528mod_md\u7ba1\u7406Let's Encrypt\u8bc1\u4e66<\/h1>\n<h2 id=\"%e4%bb%8b%e7%bb%8d-jDgrYnRLGH\">\u4ecb\u7ecd<\/h2>\n<p>\u5728\u5f53\u4eca\u7684\u4e92\u8054\u7f51\u4e16\u754c\u4e2d\uff0c\u5b89\u5168\u6027\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u4e3a\u4e86\u4fdd\u62a4\u7f51\u7ad9\u548c\u7528\u6237\u7684\u6570\u636e\uff0c\u4f7f\u7528SSL\u8bc1\u4e66\u6765\u52a0\u5bc6\u901a\u4fe1\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002Let's Encrypt\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u8bc1\u4e66\u9881\u53d1\u673a\u6784\uff0c\u53ef\u4ee5\u4e3a\u60a8\u7684\u7f51\u7ad9\u63d0\u4f9b\u514d\u8d39\u7684SSL\u8bc1\u4e66\u3002\u5728Apache\u670d\u52a1\u5668\u4e0a\uff0c\u4f7f\u7528mod_md\u6a21\u5757\u53ef\u4ee5\u8f7b\u677e\u5730\u7ba1\u7406\u548c\u81ea\u52a8\u66f4\u65b0Let's Encrypt\u8bc1\u4e66\u3002<\/p>\n<h2 id=\"%e4%bb%80%e4%b9%88%e6%98%afmod_md%e6%a8%a1%e5%9d%97%ef%bc%9f-jDgrYnRLGH\">\u4ec0\u4e48\u662fmod_md\u6a21\u5757\uff1f<\/h2>\n<p>mod_md\u662fApache HTTP\u670d\u52a1\u5668\u7684\u4e00\u4e2a\u6a21\u5757\uff0c\u5b83\u63d0\u4f9b\u4e86\u5bf9Let's Encrypt\u8bc1\u4e66\u7684\u7ba1\u7406\u548c\u81ea\u52a8\u66f4\u65b0\u529f\u80fd\u3002\u5b83\u4f7f\u7528ACME\u534f\u8bae\u4e0eLet's Encrypt\u670d\u52a1\u5668\u8fdb\u884c\u901a\u4fe1\uff0c\u5e76\u81ea\u52a8\u4e3a\u60a8\u7684\u57df\u540d\u751f\u6210\u548c\u66f4\u65b0\u8bc1\u4e66\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%85mod_md%e6%a8%a1%e5%9d%97-jDgrYnRLGH\">\u5b89\u88c5mod_md\u6a21\u5757<\/h2>\n<p>\u8981\u5728Apache\u670d\u52a1\u5668\u4e0a\u4f7f\u7528mod_md\u6a21\u5757\uff0c\u60a8\u9700\u8981\u786e\u4fdd\u60a8\u7684\u670d\u52a1\u5668\u5df2\u7ecf\u5b89\u88c5\u4e86Apache 2.4.30\u6216\u66f4\u9ad8\u7248\u672c\u3002\u60a8\u8fd8\u9700\u8981\u5b89\u88c5mod_ssl\u6a21\u5757\u548cmod_md\u6a21\u5757\u3002<\/p>\n<p>\u5728Ubuntu\u4e0a\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5mod_md\u6a21\u5757\uff1a<\/p>\n<pre><code>sudo apt-get install libapache2-mod-md<\/code><\/pre>\n<p>\u5728CentOS\u4e0a\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5mod_md\u6a21\u5757\uff1a<\/p>\n<pre><code>sudo yum install mod_md<\/code><\/pre>\n<h2 id=\"%e9%85%8d%e7%bd%aemod_md%e6%a8%a1%e5%9d%97-jDgrYnRLGH\">\u914d\u7f6emod_md\u6a21\u5757<\/h2>\n<p>\u4e00\u65e6\u5b89\u88c5\u4e86mod_md\u6a21\u5757\uff0c\u60a8\u9700\u8981\u5728Apache\u914d\u7f6e\u6587\u4ef6\u4e2d\u8fdb\u884c\u4e00\u4e9b\u914d\u7f6e\u3002\u6253\u5f00\u60a8\u7684Apache\u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u662f\/etc\/apache2\/apache2.conf\u6216\/etc\/httpd\/conf\/httpd.conf\uff09\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre><code>&lt;IfModule md_module&gt;\n  MDomain example.com\n  MDCertificateAgreement accepted\n  MDContactEmail admin@example.com\n  MDRenewMode auto\n&lt;\/IfModule&gt;<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u914d\u7f6e\u4e2d\uff0c\u60a8\u9700\u8981\u5c06example.com\u66ff\u6362\u4e3a\u60a8\u81ea\u5df1\u7684\u57df\u540d\u3002MDContactEmail\u662f\u60a8\u7684\u8054\u7cfb\u90ae\u7bb1\uff0cMDRenewMode\u8bbe\u7f6e\u4e3aauto\u8868\u793a\u81ea\u52a8\u66f4\u65b0\u8bc1\u4e66\u3002<\/p>\n<h2 id=\"%e5%90%af%e7%94%a8mod_md%e6%a8%a1%e5%9d%97-jDgrYnRLGH\">\u542f\u7528mod_md\u6a21\u5757<\/h2>\n<p>\u5b8c\u6210\u914d\u7f6e\u540e\uff0c\u60a8\u9700\u8981\u542f\u7528mod_md\u6a21\u5757\u3002\u5728Ubuntu\u4e0a\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u7528\u6a21\u5757\uff1a<\/p>\n<pre><code>sudo a2enmod md<\/code><\/pre>\n<p>\u5728CentOS\u4e0a\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u7528\u6a21\u5757\uff1a<\/p>\n<pre><code>sudo systemctl enable httpd-md<\/code><\/pre>\n<p>\u7136\u540e\u91cd\u65b0\u542f\u52a8Apache\u670d\u52a1\u5668\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<pre><code>sudo systemctl restart apache2<\/code><\/pre>\n<h2 id=\"%e9%aa%8c%e8%af%81%e8%af%81%e4%b9%a6-jDgrYnRLGH\">\u9a8c\u8bc1\u8bc1\u4e66<\/h2>\n<p>\u4e00\u65e6\u60a8\u7684\u670d\u52a1\u5668\u91cd\u65b0\u542f\u52a8\uff0cmod_md\u6a21\u5757\u5c06\u81ea\u52a8\u4e3a\u60a8\u7684\u57df\u540d\u751f\u6210\u548c\u5b89\u88c5Let's Encrypt\u8bc1\u4e66\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1\u8bc1\u4e66\u662f\u5426\u5df2\u6210\u529f\u5b89\u88c5\uff1a<\/p>\n<pre><code>sudo md-status example.com<\/code><\/pre>\n<p>\u5982\u679c\u4e00\u5207\u987a\u5229\uff0c\u60a8\u5c06\u770b\u5230\u8bc1\u4e66\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<h2 id=\"%e6%80%bb%e7%bb%93-jDgrYnRLGH\">\u603b\u7ed3<\/h2>\n<p>\u4f7f\u7528mod_md\u6a21\u5757\u53ef\u4ee5\u8f7b\u677e\u5730\u7ba1\u7406\u548c\u81ea\u52a8\u66f4\u65b0Let's Encrypt\u8bc1\u4e66\u3002\u901a\u8fc7\u914d\u7f6emod_md\u6a21\u5757\uff0c\u60a8\u53ef\u4ee5\u786e\u4fdd\u60a8\u7684\u7f51\u7ad9\u59cb\u7ec8\u4f7f\u7528\u6700\u65b0\u7684SSL\u8bc1\u4e66\uff0c\u4ece\u800c\u63d0\u9ad8\u7f51\u7ad9\u7684\u5b89\u5168\u6027\u548c\u53ef\u4fe1\u5ea6\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-jDgrYnRLGH\">\u9999\u6e2f\u670d\u52a1\u5668\u9996\u9009\u540e\u6d6a\u4e91<\/h3>\n<p>\u540e\u6d6a\u4e91\u662f\u4e00\u5bb6\u4e13\u4e1a\u7684\u4e91\u8ba1\u7b97\u516c\u53f8\uff0c\u63d0\u4f9b\u9ad8\u8d28\u91cf\u7684\u9999\u6e2f\u670d\u52a1\u5668\u3002\u4ed6\u4eec\u7684\u9999\u6e2f\u670d\u52a1\u5668\u5177\u6709\u9ad8\u6027\u80fd\u3001\u7a33\u5b9a\u6027\u548c\u5b89\u5168\u6027\uff0c\u975e\u5e38\u9002\u5408\u6258\u7ba1\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\u3002\u5982\u679c\u60a8\u6b63\u5728\u5bfb\u627e\u53ef\u9760\u7684\u9999\u6e2f\u670d\u52a1\u5668\u63d0\u4f9b\u5546\uff0c\u8bf7\u8003\u8651\u540e\u6d6a\u4e91\u3002<\/p>\n<p>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u8bbf\u95ee<a href=\"https:\/\/idc.net\">\u540e\u6d6a\u4e91\u5b98\u7f51<\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache\u5b89\u5168\u7b56\u7565\uff1a\u4f7f\u7528mod_md\u7ba1\u7406Let's Encrypt\u8bc1\u4e66 Apache\u5b89\u5168\u7b56\u7565\uff1a\u4f7f\u7528mod_m [&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-232958","post","type-post","status-publish","format-standard","hentry","category-apache"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/232958","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=232958"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/232958\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=232958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=232958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=232958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}