{"id":3857,"date":"2023-05-04T17:30:54","date_gmt":"2023-05-04T09:30:54","guid":{"rendered":"https:\/\/app.applebyme.cn\/cloud\/?p=3857"},"modified":"2023-05-04T17:30:54","modified_gmt":"2023-05-04T09:30:54","slug":"linux-%e7%94%b3%e8%af%b7ssl%e9%9c%80%e8%a6%81%e6%b3%a8%e6%84%8f%e5%93%aa%e4%ba%9b%e5%9c%b0%e6%96%b9%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/app.applebyme.cn\/cloud\/https\/3857.html","title":{"rendered":"linux \u7533\u8bf7ssl\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u5730\u65b9\uff1f"},"content":{"rendered":"<p>SSL\uff08Secure Sockets Layer\uff09\u662f\u4e00\u79cd\u57fa\u4e8e\u52a0\u5bc6\u7684\u5b89\u5168\u534f\u8bae\uff0c\u7528\u4e8e\u5728\u4e92\u8054\u7f51\u4e0a\u5b89\u5168\u5730\u4f20\u8f93\u6570\u636e\u3002SSL\u4e3b\u8981\u7528\u4e8eWeb\u6d4f\u89c8\u5668\u548cWeb\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u5b89\u5168\u901a\u4fe1\uff0c\u5b83\u53ef\u4ee5\u4fdd\u8bc1\u4f20\u8f93\u7684\u6570\u636e\u4e0d\u4f1a\u88ab\u7a83\u542c\u3001\u7be1\u6539\u6216\u4f2a\u9020\u3002<\/p>\n<p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u7533\u8bf7SSL\u8bc1\u4e66\u7684\u8fc7\u7a0b\u4e3b\u8981\u5206\u4e3a\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a<\/p>\n<p>1. \u751f\u6210\u79c1\u94a5<\/p>\n<p>\u9996\u5148\u9700\u8981\u5728\u670d\u52a1\u5668\u4e0a\u751f\u6210\u4e00\u4e2a\u79c1\u94a5\uff0c\u7528\u4e8e\u52a0\u5bc6\u548c\u89e3\u5bc6SSL\u901a\u4fe1\u4e2d\u7684\u6570\u636e\u3002\u53ef\u4ee5\u4f7f\u7528OpenSSL\u5de5\u5177\u6765\u751f\u6210\u79c1\u94a5\uff0c\u5177\u4f53\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>openssl genrsa -out server.k<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/31\/17\/29992299190.jpg\" \/><\/figure>\n<\/p>\n<p>ey 2048<\/p>\n<p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0c`server.key`\u4e3a\u751f\u6210\u7684\u79c1\u94a5\u6587\u4ef6\u540d\uff0c`2048`\u4e3a\u79c1\u94a5\u957f\u5ea6\uff0c\u4e00\u822c\u5efa\u8bae\u4f7f\u75282048\u4f4d\u6216\u4ee5\u4e0a\u7684\u957f\u5ea6\u3002<\/p>\n<p>2. \u751f\u6210\u8bc1\u4e66\u7b7e\u540d\u8bf7\u6c42\uff08CSR\uff09<\/p>\n<p>\u63a5\u4e0b\u6765\u9700\u8981\u751f\u6210\u4e00\u4e2a\u8bc1\u4e66\u7b7e\u540d\u8bf7\u6c42\uff08CSR\uff09\uff0c\u7528\u4e8e\u5411\u8bc1\u4e66\u9881\u53d1\u673a\u6784\uff08CA\uff09\u7533\u8bf7SSL\u8bc1\u4e66\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u751f\u6210CSR\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>openssl req -new -key server.key -out server.csr<\/p>\n<p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0c`server.key`\u4e3a\u4e0a\u4e00\u6b65\u751f\u6210\u7684\u79c1\u94a5\u6587\u4ef6\u540d\uff0c`server.csr`\u4e3a\u751f\u6210\u7684CSR<a href=\"https:\/\/www.yimenssl.cn\/ssl-shenqing-1259.html\">\u4e2a\u4eba\u80fd\u7533\u8bf7ssl\u8bc1\u4e66\u5417<\/a>\u6587\u4ef6\u540d\u3002<\/p>\n<p>\u5728\u751f\u6210CSR\u65f6\u9700\u8981\u586b\u5199\u4e00\u4e9b\u8bc1\u4e66\u76f8\u5173\u7684\u4fe1\u606f\uff0c\u5982\u56fd\u5bb6\u3001\u5730\u533a\u3001\u7ec4\u7ec7\u540d\u79f0\u3001Common Name\uff08\u4e00\u822c\u586b\u5199\u57df\u540d\uff09\u3001\u90ae\u7bb1\u7b49\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u586b\u5199\u7684\u4fe1\u606f\u5fc5\u987b\u4e0e\u5b9e\u9645\u60c5\u51b5\u4e00\u81f4\uff0c\u5426\u5219\u8bc1\u4e66\u7533\u8bf7\u53ef\u80fd\u4f1a\u5931\u8d25\u3002<\/p>\n<p>3. \u5411\u8bc1\u4e66\u9881\u53d1\u673a\u6784\u7533\u8bf7SSL\u8bc1\u4e66<\/p>\n<p>\u751f\u6210CSR\u540e\uff0c\u9700\u8981\u5411\u8bc1\u4e66\u9881\u53d1\u673a\u6784\uff08CA\uff09\u7533\u8bf7SSL\u8bc1\u4e66\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u53ef\u4ee5\u9009\u62e9\u4e00\u4e9b\u77e5\u540d\u7684CA\u673a\u6784\uff0c\u5982Symantec\u3001Comodo\u3001GeoTrust\u7b49\u3002\u7533\u8bf7SSL\u8bc1\u4e66\u65f6\u9700\u8981\u63d0\u4f9b\u751f\u6210\u7684CSR\u6587\u4ef6\u548c\u4e00\u4e9b\u8bc1\u4e66\u76f8\u5173\u7684\u4fe1\u606f\uff0c\u5982\u57df\u540d\u3001\u516c\u53f8\u540d\u79f0\u3001\u8054\u7cfb\u4eba\u7b49\u3002\u7533\u8bf7\u6d41\u7a0b\u548c\u5177\u4f53\u8981\u6c42\u53ef\u4ee5\u53c2\u8003CA\u673a\u6784\u7684\u5b98\u65b9\u7f51\u7ad9\u3002<\/p>\n<p>4. \u5b89\u88c5SSL\u8bc1\u4e66<\/p>\n<p>\u83b7\u5f97SSL\u8bc1\u4e66\u540e\uff0c\u9700\u8981\u5c06\u8bc1\u4e66\u5b89\u88c5\u5230\u670d\u52a1\u5668\u4e0a\u3002\u5b89\u88c5\u8fc7\u7a0b\u4f1a\u6d89\u53ca\u5230\u79c1\u94a5\u3001\u8bc1\u4e66\u548cCA\u8bc1\u4e66\u7b49\u6587\u4ef6\u7684\u590d\u5236\u548c\u914d\u7f6e\u3002\u5177\u4f53\u6b65\u9aa4\u53ef\u4ee5\u53c2\u8003SSL\u8bc1\u4e66\u63d0\u4f9b\u5546\u7684\u6587\u6863\u6216\u5b98\u65b9\u7f51\u7ad9\u3002<\/p>\n<p>5. \u914d\u7f6eWeb\u670d\u52a1\u5668<\/p>\n<p>\u5b89\u88c5SSL\u8bc1\u4e66\u540e\uff0c\u8fd8\u9700\u8981\u5728Web\u670d\u52a1\u5668\u4e0a\u8fdb\u884c\u76f8\u5e94\u7684\u914d\u7f6e\u3002\u4ee5Apache\u670d\u52a1\u5668\u4e3a\u4f8b\uff0c\u9700\u8981\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>SSLEngine on<\/p>\n<p>SSLCertificateFile \/path\/to\/ssl.crt<\/p>\n<p>SSLCertificateKeyFile \/path\/to\/server.key<\/p>\n<p>SSLCertificateChainFile \/path\/to\/ca.crt<\/p>\n<p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0c`\/path\/to\/ssl.crt`\u4e3a\u5b89\u88c5\u7684SSL\u8bc1\u4e66\u6587\u4ef6\uff0c`\/path\/to\/server.key`\u4e3a\u751f\u6210\u7684\u79c1\u94a5\u6587\u4ef6\uff0c`\/path\/to\/ca.crt`\u4e3aCA\u8bc1\u4e66\u6587\u4ef6\u3002<\/p>\n<p>\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u91cd\u542fWeb\u670d\u52a1\u5668\u5373\u53ef\u4f7f\u7528SSL\u52a0\u5bc6\u534f\u8bae\u8fdb\u884c\u5b89\u5168\u901a\u4fe1\u3002<\/p>\n<p>\u603b\u4e4b\uff0c\u5728Linux\u4e0a\u7533\u8bf7SSL\u8bc1\u4e66\u9700\u8981\u8fdb\u884c\u591a\u4e2a\u6b65\u9aa4\uff0c\u5305\u62ec\u751f\u6210\u79c1\u94a5\u3001\u751f\u6210CSR\u3001\u7533\u8bf7SSL\u8bc1\u4e66\u3001\u5b89\u88c5\u8bc1\u4e66\u548c\u914d\u7f6eWeb\u670d\u52a1\u5668\u7b49\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u6bcf\u4e2a\u6b65\u9aa4\u4e2d\u90fd\u9700\u8981\u786e\u4fdd\u586b\u5199\u7684\u4fe1\u606f\u51c6\u786e\u65e0\u8bef\uff0c\u5426\u5219\u53ef\u80fd\u4f1a\u5bfc\u81f4\u8bc1\u4e66\u7533\u8bf7\u5931\u8d25\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SSL\uff08Secure Sockets Layer\uff09\u662f\u4e00\u79cd\u57fa\u4e8e\u52a0\u5bc6\u7684\u5b89\u5168\u534f\u8bae\uff0c\u7528\u4e8e\u5728\u4e92\u8054\u7f51\u4e0a\u5b89\u5168\u5730\u4f20\u8f93\u6570\u636e\u3002SSL\u4e3b\u8981\u7528\u4e8eWeb\u6d4f\u89c8\u5668\u548cWeb\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u5b89\u5168\u901a\u4fe1\uff0c\u5b83\u53ef\u4ee5\u4fdd\u8bc1\u4f20\u8f93\u7684\u6570\u636e\u4e0d\u4f1a\u88ab\u7a83\u542c\u3001\u7be1\u6539<\/p>\n","protected":false},"author":26,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2145],"tags":[4777,4778,1024,1360,754],"class_list":["post-3857","post","type-post","status-publish","format-standard","hentry","category-https","tag-javahttps","tag-https","tag-1024","tag-1360","tag-754"],"_links":{"self":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/posts\/3857","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/comments?post=3857"}],"version-history":[{"count":0,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/posts\/3857\/revisions"}],"wp:attachment":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/media?parent=3857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/categories?post=3857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/tags?post=3857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}