{"id":159,"date":"2025-07-27T09:49:55","date_gmt":"2025-07-27T01:49:55","guid":{"rendered":"https:\/\/www.vcidc.net\/blog\/?p=159"},"modified":"2025-07-27T09:49:55","modified_gmt":"2025-07-27T01:49:55","slug":"tls%e5%8a%a0%e5%af%86%e6%8a%80%e6%9c%af%e6%93%8d%e4%bd%9c%e6%ad%a5%e9%aa%a4%e5%8f%8a%e9%87%8d%e8%a6%81%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9%e5%85%b1%e6%9c%89%e5%a4%9a%e5%b0%91%e6%ad%a5%e9%aa%a4","status":"publish","type":"post","link":"https:\/\/www.vcidc.net\/blog\/159.html","title":{"rendered":"TLS\u52a0\u5bc6\u6280\u672f\u64cd\u4f5c\u6b65\u9aa4\u53ca\u91cd\u8981\u6ce8\u610f\u4e8b\u9879\u5171\u6709\u591a\u5c11\u6b65\u9aa4\uff1f"},"content":{"rendered":"<p><h2>TLS\u52a0\u5bc6\u6280\u672f\u7b80\u4ecb\u53ca\u64cd\u4f5c\u6b65\u9aa4<\/h2>\n<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.vcidc.net\/blog\/wp-content\/uploads\/2025\/07\/WK5OZO.jpg\" alt=\"TLS\u52a0\u5bc6\u6280\u672f\u64cd\u4f5c\u6b65\u9aa4\u53ca\u91cd\u8981\u6ce8\u610f\u4e8b\u9879\u5171\u6709\u591a\u5c11\u6b65\u9aa4\uff1f\" title=\"TLS\u52a0\u5bc6\u6280\u672f\u64cd\u4f5c\u6b65\u9aa4\u53ca\u91cd\u8981\u6ce8\u610f\u4e8b\u9879\u5171\u6709\u591a\u5c11\u6b65\u9aa4\uff1f\"><\/p>\n<p><p>TLS\uff08\u4f20\u8f93\u5c42\u5b89\u5168\uff09\u662f\u4e00\u79cd\u52a0\u5bc6\u901a\u4fe1\u534f\u8bae\uff0c\u7528\u4e8e\u5728\u4e92\u8054\u7f51\u4e0a\u63d0\u4f9b\u5b89\u5168\u7684\u6570\u636e\u4f20\u8f93\u3002\u5b83\u901a\u8fc7\u5728\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u5efa\u7acb\u52a0\u5bc6\u8fde\u63a5\uff0c\u786e\u4fdd\u6570\u636e\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u7684\u673a\u5bc6\u6027\u548c\u5b8c\u6574\u6027\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecdTLS\u52a0\u5bc6\u6280\u672f\u7684\u64cd\u4f5c\u6b65\u9aa4\uff0c\u5305\u62ec\u914d\u7f6e\u3001\u547d\u4ee4\u793a\u4f8b\u53ca\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n<\/p>\n<p><h2>\u64cd\u4f5c\u6b65\u9aa4<\/h2>\n<\/p>\n<p><h3>1. \u5b89\u88c5TLS\/SSL\u5de5\u5177<\/h3>\n<\/p>\n<ul>\n<li>\u5bf9\u4e8eLinux\u7cfb\u7edf\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/li>\n<\/ul>\n<p><pre><code>sudo apt-get install openssl<\/code><\/pre>\n<\/p>\n<p><h3>2. \u751f\u6210\u8bc1\u4e66\u548c\u79c1\u94a5<\/h3>\n<\/p>\n<ul>\n<li>\u4f7f\u7528openssl\u547d\u4ee4\u751f\u6210\u81ea\u7b7e\u540d\u8bc1\u4e66\u548c\u79c1\u94a5\uff1a<\/li>\n<\/ul>\n<p><pre><code>openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -nodes -subj \"\/C=CN\/ST=Guangdong\/L=Shenzhen\/O=MyCompany\/CN=www.mycompany.com\"<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u89e3\u91ca\uff1a<\/strong><\/p>\n<p>&#8211; <code>-x509<\/code>\uff1a\u751f\u6210\u81ea\u7b7e\u540d\u8bc1\u4e66\u3002<\/p>\n<p>&#8211; <code>-newkey rsa:4096<\/code>\uff1a\u751f\u6210\u4e00\u4e2a4096\u4f4d\u7684RSA\u5bc6\u94a5\u3002<\/p>\n<p>&#8211; <code>-keyout server.key<\/code>\uff1a\u6307\u5b9a\u79c1\u94a5\u6587\u4ef6\u540d\u3002<\/p>\n<p>&#8211; <code>-out server.crt<\/code>\uff1a\u6307\u5b9a\u8bc1\u4e66\u6587\u4ef6\u540d\u3002<\/p>\n<p>&#8211; <code>-days 365<\/code>\uff1a\u8bc1\u4e66\u6709\u6548\u671f\u3002<\/p>\n<p>&#8211; <code>-nodes<\/code>\uff1a\u4e0d\u52a0\u5bc6\u79c1\u94a5\u3002<\/p>\n<p>&#8211; <code>-subj<\/code>\uff1a\u6307\u5b9a\u8bc1\u4e66\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h3>3. \u914d\u7f6eWeb\u670d\u52a1\u5668<\/h3>\n<\/p>\n<ul>\n<li>\u4ee5Apache\u4e3a\u4f8b\uff0c\u7f16\u8f91httpd.conf\u6587\u4ef6\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\uff1a<\/li>\n<\/ul>\n<p><pre><code>SSLCertificateFile \/path\/to\/server.crt<\/p>\r\n<p>SSLCertificateKeyFile \/path\/to\/server.key<\/p>\r\n<p>SSLCertificateChainFile \/path\/to\/ca.crt<\/p>\r\n<p>SSLProtocol all -TLSv1.2 -TLSv1.3<\/p>\r\n<p>SSLHonorCipherOrder on<\/p>\r\n<p>SSLCipherSuite HIGH:!aNULL:!MD5<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u89e3\u91ca\uff1a<\/strong><\/p>\n<p>&#8211; <code>SSLCertificateFile<\/code>\uff1a\u6307\u5b9a\u8bc1\u4e66\u6587\u4ef6\u3002<\/p>\n<p>&#8211; <code>SSLCertificateKeyFile<\/code>\uff1a\u6307\u5b9a\u79c1\u94a5\u6587\u4ef6\u3002<\/p>\n<p>&#8211; <code>SSLCertificateChainFile<\/code>\uff1a\u6307\u5b9aCA\u8bc1\u4e66\u6587\u4ef6\u3002<\/p>\n<p>&#8211; <code>SSLProtocol<\/code>\uff1a\u6307\u5b9a\u652f\u6301\u7684TLS\u7248\u672c\u3002<\/p>\n<p>&#8211; <code>SSLHonorCipherOrder<\/code>\uff1a\u6309\u7167\u914d\u7f6e\u7684\u987a\u5e8f\u9009\u62e9\u52a0\u5bc6\u5957\u4ef6\u3002<\/p>\n<p>&#8211; <code>SSLCipherSuite<\/code>\uff1a\u6307\u5b9a\u652f\u6301\u7684\u52a0\u5bc6\u5957\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>4. \u91cd\u542fWeb\u670d\u52a1\u5668<\/h3>\n<\/p>\n<ul>\n<li>\u91cd\u542fApache\u670d\u52a1\u5668\u4ee5\u5e94\u7528\u914d\u7f6e\u66f4\u6539\uff1a<\/li>\n<\/ul>\n<p><pre><code>sudo systemctl restart apache2<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u6ce8\u610f\u4e8b\u9879\u548c\u5b9e\u7528\u6280\u5de7<\/h2>\n<\/p>\n<ul>\n<li>\u786e\u4fdd\u8bc1\u4e66\u548c\u79c1\u94a5\u6587\u4ef6\u6743\u9650\u6b63\u786e\uff0c\u53ea\u6709\u670d\u52a1\u5668\u8fdb\u7a0b\u53ef\u4ee5\u8bbf\u95ee\u3002<\/li>\n<li>\u5b9a\u671f\u66f4\u6362\u8bc1\u4e66\u548c\u79c1\u94a5\uff0c\u4ee5\u4fdd\u8bc1\u5b89\u5168\u6027\u3002<\/li>\n<li>\u4f7f\u7528\u5f3a\u5bc6\u7801\u4fdd\u62a4\u79c1\u94a5\u6587\u4ef6\u3002<\/li>\n<li>\u5728\u914d\u7f6eSSL\u65f6\uff0c\u907f\u514d\u4f7f\u7528\u5df2\u77e5\u7684\u5f31\u52a0\u5bc6\u5957\u4ef6\u3002<\/li>\n<li>\u76d1\u63a7SSL\u8fde\u63a5\u72b6\u6001\uff0c\u786e\u4fdd\u670d\u52a1\u5668\u6b63\u5e38\u8fd0\u884c\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>TLS\u52a0\u5bc6\u6280\u672f\u7b80\u4ecb\u53ca\u64cd\u4f5c\u6b65\u9aa4 TLS\uff08\u4f20\u8f93\u5c42\u5b89\u5168\uff09\u662f\u4e00\u79cd\u52a0\u5bc6\u901a\u4fe1\u534f\u8bae\uff0c\u7528\u4e8e\u5728\u4e92\u8054\u7f51\u4e0a\u63d0\u4f9b\u5b89\u5168\u7684\u6570\u636e\u4f20\u8f93\u3002\u5b83\u901a\u8fc7\u5728\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u5efa\u7acb\u52a0\u5bc6\u8fde\u63a5\uff0c\u786e\u4fdd\u6570\u636e\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u7684\u673a\u5bc6\u6027\u548c\u5b8c\u6574\u6027\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecdTLS\u52a0\u5bc6\u6280\u672f\u7684\u64cd\u4f5c\u6b65\u9aa4\uff0c\u5305\u62ec\u914d\u7f6e\u3001\u547d\u4ee4\u793a\u4f8b\u53ca&#8230;<\/p>\n","protected":false},"author":1,"featured_media":160,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,100,56],"topic":[],"class_list":["post-159","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mir","tag-tls","tag-100","tag-56"],"_links":{"self":[{"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/posts\/159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/comments?post=159"}],"version-history":[{"count":1,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/posts\/159\/revisions"}],"predecessor-version":[{"id":162,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/posts\/159\/revisions\/162"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/media\/160"}],"wp:attachment":[{"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/media?parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/categories?post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/tags?post=159"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.vcidc.net\/blog\/wp-json\/wp\/v2\/topic?post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}