{"id":46808,"date":"2025-07-30T04:17:19","date_gmt":"2025-07-29T20:17:19","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/46808.html"},"modified":"2025-07-30T04:17:19","modified_gmt":"2025-07-29T20:17:19","slug":"%e3%80%90%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8e%e9%83%a8%e7%bd%b2-23%e3%80%91https%e9%85%8d%e7%bd%ae%e5%ae%9e%e6%88%98%ef%bc%9aweb%e5%ba%94%e7%94%a8%e5%ae%89%e5%85%a8%e4%bc%a0%e8%be%93%e5%8d%8f%e8%ae%ae","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/46808.html","title":{"rendered":"\u3010\u670d\u52a1\u5668\u4e0e\u90e8\u7f72 23\u3011HTTPS\u914d\u7f6e\u5b9e\u6218\uff1aWeb\u5e94\u7528\u5b89\u5168\u4f20\u8f93\u534f\u8bae\u914d\u7f6e\u8ba9\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u63d0\u534710\u500d"},"content":{"rendered":"<h2>\u3010\u670d\u52a1\u5668\u4e0e\u90e8\u7f72 23\u3011HTTPS\u914d\u7f6e\u5b9e\u6218&#xff1a;Web\u5e94\u7528\u5b89\u5168\u4f20\u8f93\u534f\u8bae\u914d\u7f6e\u8ba9\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u63d0\u534710\u500d<\/h2>\n<p>\u5173\u952e\u8bcd&#xff1a;HTTPS\u914d\u7f6e\u3001SSL\u8bc1\u4e66\u3001Web\u5b89\u5168\u3001\u4f20\u8f93\u52a0\u5bc6\u3001TLS\u534f\u8bae\u3001Nginx HTTPS\u3001Apache HTTPS\u3001\u8bc1\u4e66\u7533\u8bf7\u3001\u5b89\u5168\u914d\u7f6e\u3001HSTS<\/p>\n<p>\u6458\u8981&#xff1a;\u672c\u6587\u4ece\u96f6\u5f00\u59cb\u8bb2\u89e3HTTPS\u914d\u7f6e\u7684\u5b8c\u6574\u6d41\u7a0b&#xff0c;\u901a\u8fc7\u5b9e\u9645\u6848\u4f8b\u6f14\u793a\u5982\u4f55\u5728Nginx\u548cApache\u670d\u52a1\u5668\u4e0a\u914d\u7f6eSSL\u8bc1\u4e66&#xff0c;\u5b9e\u73b0Web\u5e94\u7528\u7684\u5b89\u5168\u4f20\u8f93\u3002\u6db5\u76d6\u8bc1\u4e66\u7533\u8bf7\u3001\u914d\u7f6e\u4f18\u5316\u3001\u5b89\u5168\u52a0\u56fa\u7b49\u6838\u5fc3\u6280\u672f&#xff0c;\u5e2e\u52a9\u5f00\u53d1\u8005\u6784\u5efa\u4f01\u4e1a\u7ea7\u7684HTTPS\u5b89\u5168\u9632\u62a4\u4f53\u7cfb\u3002<\/p>\n<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>\u3010\u670d\u52a1\u5668\u4e0e\u90e8\u7f72 23\u3011HTTPS\u914d\u7f6e\u5b9e\u6218&#xff1a;Web\u5e94\u7528\u5b89\u5168\u4f20\u8f93\u534f\u8bae\u914d\u7f6e\u8ba9\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u63d0\u534710\u500d<\/li>\n<li>\n<ul>\n<li>\u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48HTTPS\u662f\u73b0\u4ee3Web\u5e94\u7528\u7684\u5fc5\u9700\u54c1&#xff1f;<\/li>\n<li>\u7b2c\u4e00\u7ae0&#xff1a;HTTPS\u5de5\u4f5c\u539f\u7406\u6df1\u5ea6\u89e3\u6790<\/li>\n<li>\n<ul>\n<li>1.1 \u4ec0\u4e48\u662fHTTPS&#xff1f;<\/li>\n<li>1.2 HTTPS\u63e1\u624b\u8fc7\u7a0b\u8be6\u89e3<\/li>\n<li>1.3 \u5bf9\u79f0\u52a0\u5bc6\u4e0e\u975e\u5bf9\u79f0\u52a0\u5bc6<\/li>\n<\/ul>\n<\/li>\n<li>\u7b2c\u4e8c\u7ae0&#xff1a;SSL\u8bc1\u4e66\u7533\u8bf7\u4e0e\u7ba1\u7406<\/li>\n<li>\n<ul>\n<li>2.1 SSL\u8bc1\u4e66\u7c7b\u578b\u8be6\u89e3<\/li>\n<li>2.2 \u514d\u8d39SSL\u8bc1\u4e66 vs \u4ed8\u8d39SSL\u8bc1\u4e66<\/li>\n<li>2.3 Let&#039;s Encrypt\u8bc1\u4e66\u7533\u8bf7\u5b9e\u6218<\/li>\n<\/ul>\n<\/li>\n<li>\u7b2c\u4e09\u7ae0&#xff1a;Nginx HTTPS\u914d\u7f6e\u8be6\u89e3<\/li>\n<li>\n<ul>\n<li>3.1 \u57fa\u7840HTTPS\u914d\u7f6e<\/li>\n<li>3.2 SSL\u5b89\u5168\u914d\u7f6e\u4f18\u5316<\/li>\n<li>3.3 Python Web\u5e94\u7528HTTPS\u914d\u7f6e<\/li>\n<\/ul>\n<\/li>\n<li>\u7b2c\u56db\u7ae0&#xff1a;Apache HTTPS\u914d\u7f6e\u5b9e\u6218<\/li>\n<li>\n<ul>\n<li>4.1 Apache SSL\u6a21\u5757\u542f\u7528<\/li>\n<li>4.2 \u865a\u62df\u4e3b\u673aHTTPS\u914d\u7f6e<\/li>\n<li>4.3 Python WSGI\u5e94\u7528HTTPS\u914d\u7f6e<\/li>\n<\/ul>\n<\/li>\n<li>\u7b2c\u4e94\u7ae0&#xff1a;HTTPS\u6027\u80fd\u4f18\u5316\u4e0e\u76d1\u63a7<\/li>\n<li>\n<ul>\n<li>5.1 SSL\u6027\u80fd\u4f18\u5316\u7b56\u7565<\/li>\n<li>5.2 SSL\u8bc1\u4e66\u76d1\u63a7\u811a\u672c<\/li>\n<li>5.3 SSL\u914d\u7f6e\u5b89\u5168\u8bc4\u4f30<\/li>\n<\/ul>\n<\/li>\n<li>\u7b2c\u516d\u7ae0&#xff1a;\u5e38\u89c1\u95ee\u9898\u6392\u67e5\u4e0e\u89e3\u51b3<\/li>\n<li>\n<ul>\n<li>6.1 \u8bc1\u4e66\u76f8\u5173\u95ee\u9898<\/li>\n<li>6.2 \u6027\u80fd\u95ee\u9898\u6392\u67e5<\/li>\n<li>6.3 \u914d\u7f6e\u9a8c\u8bc1\u811a\u672c<\/li>\n<\/ul>\n<\/li>\n<li>\u7b2c\u4e03\u7ae0&#xff1a;\u4f01\u4e1a\u7ea7HTTPS\u6700\u4f73\u5b9e\u8df5<\/li>\n<li>\n<ul>\n<li>7.1 \u591a\u57df\u540d\u8bc1\u4e66\u7ba1\u7406<\/li>\n<li>7.2 SSL\u8bc1\u4e66\u81ea\u52a8\u5316\u7ba1\u7406<\/li>\n<li>7.3 HTTPS\u5b89\u5168\u52a0\u56fa<\/li>\n<\/ul>\n<\/li>\n<li>\u7ed3\u8bed&#xff1a;\u6784\u5efa\u4f01\u4e1a\u7ea7HTTPS\u5b89\u5168\u9632\u62a4\u4f53\u7cfb<\/li>\n<li>\u53c2\u8003\u8d44\u6599<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48HTTPS\u662f\u73b0\u4ee3Web\u5e94\u7528\u7684\u5fc5\u9700\u54c1&#xff1f;<\/h3>\n<p>\u60f3\u8c61\u4e00\u4e0b&#xff0c;\u4f60\u5728\u5496\u5561\u5e97\u91cc\u8fde\u63a5\u516c\u5171WiFi&#xff0c;\u7136\u540e\u767b\u5f55\u4f60\u7684\u94f6\u884c\u8d26\u6237\u3002\u5982\u679c\u8fd9\u4e2a\u7f51\u7ad9\u4f7f\u7528\u7684\u662fHTTP\u534f\u8bae&#xff0c;\u90a3\u4e48\u4f60\u7684\u8d26\u53f7\u5bc6\u7801\u5c31\u50cf\u5728\u5927\u8857\u4e0a\u88f8\u5954\u4e00\u6837&#xff0c;\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u8f7b\u6613\u83b7\u53d6\u3002\u800cHTTPS\u5c31\u50cf\u7ed9\u4f60\u7684\u6570\u636e\u7a7f\u4e0a\u4e86\u4e00\u4ef6\u9690\u5f62\u7684\u76d4\u7532&#xff0c;\u8ba9\u9ed1\u5ba2\u65e0\u6cd5\u7aa5\u63a2\u3002<\/p>\n<p>\u5728\u4eca\u5929\u7684\u4e92\u8054\u7f51\u4e16\u754c\u4e2d&#xff0c;HTTPS\u5df2\u7ecf\u4e0d\u518d\u662f\u53ef\u9009\u9879&#xff0c;\u800c\u662f\u5fc5\u9700\u54c1\u3002Google\u4ece2014\u5e74\u5f00\u59cb\u5c31\u5c06HTTPS\u4f5c\u4e3a\u641c\u7d22\u6392\u540d\u7684\u56e0\u7d20\u4e4b\u4e00&#xff0c;Chrome\u6d4f\u89c8\u5668\u4e5f\u4f1a\u5bf9HTTP\u7f51\u7ad9\u663e\u793a&#034;\u4e0d\u5b89\u5168&#034;\u8b66\u544a\u3002\u66f4\u91cd\u8981\u7684\u662f&#xff0c;HTTPS\u80fd\u591f&#xff1a;<\/p>\n<ul>\n<li>\u4fdd\u62a4\u7528\u6237\u9690\u79c1&#xff1a;\u52a0\u5bc6\u4f20\u8f93\u6570\u636e&#xff0c;\u9632\u6b62\u7a83\u542c<\/li>\n<li>\u786e\u4fdd\u6570\u636e\u5b8c\u6574\u6027&#xff1a;\u9632\u6b62\u6570\u636e\u5728\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u88ab\u7be1\u6539<\/li>\n<li>\u8eab\u4efd\u9a8c\u8bc1&#xff1a;\u786e\u8ba4\u7f51\u7ad9\u7684\u771f\u5b9e\u6027&#xff0c;\u9632\u6b62\u9493\u9c7c\u653b\u51fb<\/li>\n<li>\u63d0\u5347SEO\u6392\u540d&#xff1a;\u641c\u7d22\u5f15\u64ce\u66f4\u504f\u7231HTTPS\u7f51\u7ad9<\/li>\n<li>\u589e\u5f3a\u7528\u6237\u4fe1\u4efb&#xff1a;\u6d4f\u89c8\u5668\u5730\u5740\u680f\u7684\u7eff\u8272\u9501\u5934\u8ba9\u7528\u6237\u66f4\u6709\u5b89\u5168\u611f<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729201714-68892c4a5acb5.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>\u7b2c\u4e00\u7ae0&#xff1a;HTTPS\u5de5\u4f5c\u539f\u7406\u6df1\u5ea6\u89e3\u6790<\/h3>\n<h4>1.1 \u4ec0\u4e48\u662fHTTPS&#xff1f;<\/h4>\n<p>HTTPS&#xff08;HyperText Transfer Protocol Secure&#xff09;\u662fHTTP\u7684\u5b89\u5168\u7248\u672c&#xff0c;\u5b83\u5728HTTP\u548cTCP\u4e4b\u95f4\u6dfb\u52a0\u4e86\u4e00\u4e2a\u5b89\u5168\u5c42\u3002\u8fd9\u4e2a\u5b89\u5168\u5c42\u4e3b\u8981\u7531\u4e24\u4e2a\u534f\u8bae\u7ec4\u6210&#xff1a;<\/p>\n<ul>\n<li>SSL&#xff08;Secure Sockets Layer&#xff09;&#xff1a;\u8f83\u8001\u7684\u534f\u8bae&#xff0c;\u73b0\u5728\u57fa\u672c\u4e0d\u7528<\/li>\n<li>TLS&#xff08;Transport Layer Security&#xff09;&#xff1a;SSL\u7684\u7ee7\u4efb\u8005&#xff0c;\u76ee\u524d\u4e3b\u6d41\u7248\u672c\u662fTLS 1.2\u548cTLS 1.3<\/li>\n<\/ul>\n<h4>1.2 HTTPS\u63e1\u624b\u8fc7\u7a0b\u8be6\u89e3<\/h4>\n<p>\u8ba9\u6211\u4eec\u7528\u4e00\u4e2a\u751f\u52a8\u7684\u6bd4\u55bb\u6765\u7406\u89e3HTTPS\u63e1\u624b\u8fc7\u7a0b&#xff1a;<\/p>\n<p>\u60f3\u8c61\u4f60\u8981\u7ed9\u670b\u53cb\u5bc4\u4e00\u5c01\u91cd\u8981\u7684\u4fe1\u4ef6&#xff0c;\u4f46\u4f60\u4eec\u4e4b\u95f4\u6ca1\u6709\u7ea6\u5b9a\u597d\u7684\u5bc6\u7801\u3002\u4f60\u4eec\u9700\u8981\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5efa\u7acb\u5b89\u5168\u901a\u4fe1&#xff1a;<\/p>\n<li>\n<p>\u5ba2\u6237\u7aef\u95ee\u5019&#xff08;Client Hello&#xff09;<\/p>\n<ul>\n<li>\u6d4f\u89c8\u5668\u5411\u670d\u52a1\u5668\u53d1\u9001\u652f\u6301\u7684\u52a0\u5bc6\u7b97\u6cd5\u5217\u8868<\/li>\n<li>\u5c31\u50cf\u8bf4&#xff1a;\u201c\u6211\u4f1a\u8fd9\u4e9b\u52a0\u5bc6\u65b9\u6cd5&#xff0c;\u4f60\u9009\u4e00\u4e2a\u5427\u201d<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u670d\u52a1\u5668\u56de\u5e94&#xff08;Server Hello&#xff09;<\/p>\n<ul>\n<li>\u670d\u52a1\u5668\u9009\u62e9\u52a0\u5bc6\u7b97\u6cd5\u5e76\u53d1\u9001\u6570\u5b57\u8bc1\u4e66<\/li>\n<li>\u5c31\u50cf\u56de\u590d&#xff1a;\u201c\u6211\u9009\u8fd9\u4e2a\u52a0\u5bc6\u65b9\u6cd5&#xff0c;\u8fd9\u662f\u6211\u7684\u8eab\u4efd\u8bc1\u660e\u201d<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8bc1\u4e66\u9a8c\u8bc1<\/p>\n<ul>\n<li>\u6d4f\u89c8\u5668\u9a8c\u8bc1\u670d\u52a1\u5668\u8bc1\u4e66\u7684\u6709\u6548\u6027<\/li>\n<li>\u5c31\u50cf\u68c0\u67e5\u8eab\u4efd\u8bc1\u662f\u5426\u662f\u771f\u7684<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5bc6\u94a5\u4ea4\u6362<\/p>\n<ul>\n<li>\u53cc\u65b9\u534f\u5546\u51fa\u4e00\u4e2a\u5171\u540c\u7684\u5bc6\u94a5<\/li>\n<li>\u5c31\u50cf\u7ea6\u5b9a\u597d\u6697\u53f7<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5f00\u59cb\u52a0\u5bc6\u901a\u4fe1<\/p>\n<ul>\n<li>\u4f7f\u7528\u534f\u5546\u597d\u7684\u5bc6\u94a5\u52a0\u5bc6\u6240\u6709\u6570\u636e<\/li>\n<li>\u5f00\u59cb\u7528\u6697\u53f7\u901a\u4fe1<\/li>\n<\/ul>\n<\/li>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729201715-68892c4b320d9.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h4>1.3 \u5bf9\u79f0\u52a0\u5bc6\u4e0e\u975e\u5bf9\u79f0\u52a0\u5bc6<\/h4>\n<p>HTTPS\u5de7\u5999\u5730\u7ed3\u5408\u4e86\u4e24\u79cd\u52a0\u5bc6\u65b9\u5f0f&#xff1a;<\/p>\n<p>\u975e\u5bf9\u79f0\u52a0\u5bc6&#xff1a;<\/p>\n<ul>\n<li>\u7528\u4e8e\u63e1\u624b\u9636\u6bb5\u7684\u5bc6\u94a5\u4ea4\u6362<\/li>\n<li>\u6709\u516c\u94a5\u548c\u79c1\u94a5\u4e24\u628a\u94a5\u5319<\/li>\n<li>\u5b89\u5168\u6027\u9ad8\u4f46\u901f\u5ea6\u6162<\/li>\n<li>\u5c31\u50cf\u4e00\u4e2a\u4fdd\u9669\u7bb1&#xff0c;\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u5f80\u91cc\u653e\u4e1c\u897f&#xff08;\u516c\u94a5&#xff09;&#xff0c;\u4f46\u53ea\u6709\u62e5\u6709\u79c1\u94a5\u7684\u4eba\u624d\u80fd\u6253\u5f00<\/li>\n<\/ul>\n<p>\u5bf9\u79f0\u52a0\u5bc6&#xff1a;<\/p>\n<ul>\n<li>\u7528\u4e8e\u5b9e\u9645\u6570\u636e\u4f20\u8f93<\/li>\n<li>\u53ea\u6709\u4e00\u628a\u94a5\u5319&#xff0c;\u53cc\u65b9\u5171\u4eab<\/li>\n<li>\u901f\u5ea6\u5feb\u4f46\u5bc6\u94a5\u5206\u53d1\u56f0\u96be<\/li>\n<li>\u5c31\u50cf\u4e00\u4e2a\u666e\u901a\u7684\u9501&#xff0c;\u5f00\u9501\u548c\u9501\u95e8\u7528\u540c\u4e00\u628a\u94a5\u5319<\/li>\n<\/ul>\n<h3>\u7b2c\u4e8c\u7ae0&#xff1a;SSL\u8bc1\u4e66\u7533\u8bf7\u4e0e\u7ba1\u7406<\/h3>\n<h4>2.1 SSL\u8bc1\u4e66\u7c7b\u578b\u8be6\u89e3<\/h4>\n<p>SSL\u8bc1\u4e66\u5c31\u50cf\u7f51\u7ad9\u7684\u8eab\u4efd\u8bc1&#xff0c;\u4e0d\u540c\u7c7b\u578b\u7684\u8bc1\u4e66\u63d0\u4f9b\u4e0d\u540c\u7ea7\u522b\u7684\u9a8c\u8bc1&#xff1a;<\/p>\n<p>1. \u57df\u540d\u9a8c\u8bc1&#xff08;DV&#xff09;\u8bc1\u4e66<\/p>\n<ul>\n<li>\u6700\u57fa\u7840\u7684\u8bc1\u4e66\u7c7b\u578b<\/li>\n<li>\u53ea\u9a8c\u8bc1\u57df\u540d\u6240\u6709\u6743<\/li>\n<li>\u7533\u8bf7\u7b80\u5355&#xff0c;\u51e0\u5206\u949f\u5373\u53ef\u5b8c\u6210<\/li>\n<li>\u9002\u5408\u4e2a\u4eba\u7f51\u7ad9\u548c\u5c0f\u578b\u9879\u76ee<\/li>\n<\/ul>\n<p>2. \u7ec4\u7ec7\u9a8c\u8bc1&#xff08;OV&#xff09;\u8bc1\u4e66<\/p>\n<ul>\n<li>\u9a8c\u8bc1\u57df\u540d\u6240\u6709\u6743\u548c\u7ec4\u7ec7\u4fe1\u606f<\/li>\n<li>\u9700\u8981\u63d0\u4f9b\u4f01\u4e1a\u76f8\u5173\u6587\u4ef6<\/li>\n<li>\u7533\u8bf7\u65f6\u95f41-3\u4e2a\u5de5\u4f5c\u65e5<\/li>\n<li>\u9002\u5408\u4e2d\u5c0f\u4f01\u4e1a\u7f51\u7ad9<\/li>\n<\/ul>\n<p>3. \u6269\u5c55\u9a8c\u8bc1&#xff08;EV&#xff09;\u8bc1\u4e66<\/p>\n<ul>\n<li>\u6700\u9ad8\u7ea7\u522b\u7684\u9a8c\u8bc1<\/li>\n<li>\u4e25\u683c\u9a8c\u8bc1\u4f01\u4e1a\u8eab\u4efd\u548c\u6cd5\u5f8b\u5730\u4f4d<\/li>\n<li>\u6d4f\u89c8\u5668\u5730\u5740\u680f\u663e\u793a\u7eff\u8272\u4f01\u4e1a\u540d\u79f0<\/li>\n<li>\u7533\u8bf7\u65f6\u95f45-10\u4e2a\u5de5\u4f5c\u65e5<\/li>\n<li>\u9002\u5408\u5927\u578b\u4f01\u4e1a\u548c\u91d1\u878d\u673a\u6784<\/li>\n<\/ul>\n<h4>2.2 \u514d\u8d39SSL\u8bc1\u4e66 vs \u4ed8\u8d39SSL\u8bc1\u4e66<\/h4>\n<p>\u514d\u8d39\u8bc1\u4e66&#xff08;\u5982Let\u2019s Encrypt&#xff09;&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u4f18\u70b9<\/span><br \/>\n&#8211; \u5b8c\u5168\u514d\u8d39<br \/>\n&#8211; \u81ea\u52a8\u5316\u7533\u8bf7\u548c\u7eed\u671f<br \/>\n&#8211; \u5b89\u5168\u6027\u4e0e\u4ed8\u8d39\u8bc1\u4e66\u76f8\u540c<br \/>\n&#8211; \u652f\u6301\u901a\u914d\u7b26\u8bc1\u4e66<\/p>\n<p><span class=\"token comment\"># \u7f3a\u70b9<\/span><br \/>\n&#8211; \u53ea\u652f\u6301DV\u9a8c\u8bc1<br \/>\n&#8211; \u6709\u6548\u671f\u8f83\u77ed&#xff08;90\u5929&#xff09;<br \/>\n&#8211; \u6280\u672f\u652f\u6301\u6709\u9650<br \/>\n&#8211; \u4e0d\u9002\u5408\u4f01\u4e1a\u7ea7\u5e94\u7528<\/p>\n<p>\u4ed8\u8d39\u8bc1\u4e66&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u4f18\u70b9<\/span><br \/>\n&#8211; \u652f\u6301\u6240\u6709\u9a8c\u8bc1\u7c7b\u578b<br \/>\n&#8211; \u6709\u6548\u671f\u957f&#xff08;1-2\u5e74&#xff09;<br \/>\n&#8211; \u4e13\u4e1a\u6280\u672f\u652f\u6301<br \/>\n&#8211; \u4fdd\u9669\u8d54\u4ed8\u4fdd\u969c<br \/>\n&#8211; \u4f01\u4e1a\u7ea7\u4fe1\u4efb\u5ea6\u9ad8<\/p>\n<p><span class=\"token comment\"># \u7f3a\u70b9<\/span><br \/>\n&#8211; \u9700\u8981\u4ed8\u8d39<br \/>\n&#8211; \u624b\u52a8\u7533\u8bf7\u548c\u7ba1\u7406<br \/>\n&#8211; \u7eed\u671f\u53ef\u80fd\u5fd8\u8bb0<\/p>\n<h4>2.3 Let\u2019s Encrypt\u8bc1\u4e66\u7533\u8bf7\u5b9e\u6218<\/h4>\n<p>Let\u2019s Encrypt\u662f\u4e00\u4e2a\u514d\u8d39\u3001\u81ea\u52a8\u5316\u3001\u5f00\u653e\u7684\u8bc1\u4e66\u9881\u53d1\u673a\u6784&#xff0c;\u8ba9\u6211\u4eec\u770b\u770b\u5982\u4f55\u7533\u8bf7&#xff1a;<\/p>\n<p>\u5b89\u88c5Certbot&#xff1a;<\/p>\n<p><span class=\"token comment\"># Ubuntu\/Debian<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> update<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> certbot python3-certbot-nginx<\/p>\n<p><span class=\"token comment\"># CentOS\/RHEL<\/span><br \/>\n<span class=\"token function\">sudo<\/span> yum <span class=\"token function\">install<\/span> certbot python3-certbot-nginx<\/p>\n<p><span class=\"token comment\"># \u6216\u8005\u4f7f\u7528snap\u5b89\u88c5&#xff08;\u63a8\u8350&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> snap <span class=\"token function\">install<\/span> &#8211;classic certbot<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">ln<\/span> -s \/snap\/bin\/certbot \/usr\/bin\/certbot<\/p>\n<p>\u7533\u8bf7\u5355\u57df\u540d\u8bc1\u4e66&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u4e3a\u5355\u4e2a\u57df\u540d\u7533\u8bf7\u8bc1\u4e66<\/span><br \/>\n<span class=\"token function\">sudo<\/span> certbot &#8211;nginx -d example.com<\/p>\n<p><span class=\"token comment\"># \u4e3a\u591a\u4e2a\u57df\u540d\u7533\u8bf7\u8bc1\u4e66<\/span><br \/>\n<span class=\"token function\">sudo<\/span> certbot &#8211;nginx -d example.com -d www.example.com<\/p>\n<p>\u7533\u8bf7\u901a\u914d\u7b26\u8bc1\u4e66&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u901a\u914d\u7b26\u8bc1\u4e66\u9700\u8981DNS\u9a8c\u8bc1<\/span><br \/>\n<span class=\"token function\">sudo<\/span> certbot certonly &#8211;manual &#8211;preferred-challenges dns -d <span class=\"token string\">&#034;*.example.com&#034;<\/span><\/p>\n<p>\u81ea\u52a8\u7eed\u671f\u914d\u7f6e&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u6d4b\u8bd5\u7eed\u671f<\/span><br \/>\n<span class=\"token function\">sudo<\/span> certbot renew &#8211;dry-run<\/p>\n<p><span class=\"token comment\"># \u8bbe\u7f6e\u81ea\u52a8\u7eed\u671f<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">crontab<\/span> -e<br \/>\n<span class=\"token comment\"># \u6dfb\u52a0\u4ee5\u4e0b\u884c<\/span><br \/>\n<span class=\"token number\">0<\/span> <span class=\"token number\">12<\/span> * * * \/usr\/bin\/certbot renew &#8211;quiet<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729201716-68892c4c08979.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>\u7b2c\u4e09\u7ae0&#xff1a;Nginx HTTPS\u914d\u7f6e\u8be6\u89e3<\/h3>\n<h4>3.1 \u57fa\u7840HTTPS\u914d\u7f6e<\/h4>\n<p>\u8ba9\u6211\u4eec\u4ece\u4e00\u4e2a\u7b80\u5355\u7684Nginx HTTPS\u914d\u7f6e\u5f00\u59cb&#xff1a;<\/p>\n<p>server {<br \/>\n    listen 80;<br \/>\n    server_name example.com www.example.com;<\/p>\n<p>    # HTTP\u91cd\u5b9a\u5411\u5230HTTPS<br \/>\n    return 301 https:\/\/$server_name$request_uri;<br \/>\n}<\/p>\n<p>server {<br \/>\n    listen 443 ssl http2;<br \/>\n    server_name example.com www.example.com;<\/p>\n<p>    # SSL\u8bc1\u4e66\u914d\u7f6e<br \/>\n    ssl_certificate \/etc\/letsencrypt\/live\/example.com\/fullchain.pem;<br \/>\n    ssl_certificate_key \/etc\/letsencrypt\/live\/example.com\/privkey.pem;<\/p>\n<p>    # SSL\u914d\u7f6e<br \/>\n    ssl_protocols TLSv1.2 TLSv1.3;<br \/>\n    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384;<br \/>\n    ssl_prefer_server_ciphers off;<\/p>\n<p>    # \u7f51\u7ad9\u6839\u76ee\u5f55<br \/>\n    root \/var\/www\/html;<br \/>\n    index index.html index.htm;<\/p>\n<p>    location \/ {<br \/>\n        try_files $uri $uri\/ &#061;404;<br \/>\n    }<br \/>\n}<\/p>\n<h4>3.2 SSL\u5b89\u5168\u914d\u7f6e\u4f18\u5316<\/h4>\n<p>\u5f3a\u5316SSL\u914d\u7f6e&#xff1a;<\/p>\n<p># SSL\u4f1a\u8bdd\u7f13\u5b58<br \/>\nssl_session_cache shared:SSL:10m;<br \/>\nssl_session_timeout 10m;<\/p>\n<p># SSL\u4f1a\u8bdd\u7968\u636e<br \/>\nssl_session_tickets off;<\/p>\n<p># OCSP\u88c5\u8ba2<br \/>\nssl_stapling on;<br \/>\nssl_stapling_verify on;<br \/>\nssl_trusted_certificate \/etc\/letsencrypt\/live\/example.com\/chain.pem;<\/p>\n<p># DNS\u89e3\u6790\u5668<br \/>\nresolver 8.8.8.8 8.8.4.4 valid&#061;300s;<br \/>\nresolver_timeout 5s;<\/p>\n<p># \u5b89\u5168\u5934\u90e8<br \/>\nadd_header Strict-Transport-Security &#034;max-age&#061;31536000; includeSubDomains; preload&#034; always;<br \/>\nadd_header X-Frame-Options DENY always;<br \/>\nadd_header X-Content-Type-Options nosniff always;<br \/>\nadd_header X-XSS-Protection &#034;1; mode&#061;block&#034; always;<br \/>\nadd_header Referrer-Policy &#034;strict-origin-when-cross-origin&#034; always;<\/p>\n<h4>3.3 Python Web\u5e94\u7528HTTPS\u914d\u7f6e<\/h4>\n<p>Flask\u5e94\u7528\u914d\u7f6e&#xff1a;<\/p>\n<p>server {<br \/>\n    listen 443 ssl http2;<br \/>\n    server_name api.example.com;<\/p>\n<p>    ssl_certificate \/etc\/letsencrypt\/live\/api.example.com\/fullchain.pem;<br \/>\n    ssl_certificate_key \/etc\/letsencrypt\/live\/api.example.com\/privkey.pem;<\/p>\n<p>    location \/ {<br \/>\n        proxy_pass http:\/\/127.0.0.1:5000;<br \/>\n        proxy_set_header Host $host;<br \/>\n        proxy_set_header X-Real-IP $remote_addr;<br \/>\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br \/>\n        proxy_set_header X-Forwarded-Proto $scheme;<\/p>\n<p>        # WebSocket\u652f\u6301<br \/>\n        proxy_http_version 1.1;<br \/>\n        proxy_set_header Upgrade $http_upgrade;<br \/>\n        proxy_set_header Connection &#034;upgrade&#034;;<br \/>\n    }<br \/>\n}<\/p>\n<p>Django\u5e94\u7528\u914d\u7f6e&#xff1a;<\/p>\n<p>server {<br \/>\n    listen 443 ssl http2;<br \/>\n    server_name django.example.com;<\/p>\n<p>    ssl_certificate \/etc\/letsencrypt\/live\/django.example.com\/fullchain.pem;<br \/>\n    ssl_certificate_key \/etc\/letsencrypt\/live\/django.example.com\/privkey.pem;<\/p>\n<p>    # \u9759\u6001\u6587\u4ef6<br \/>\n    location \/static\/ {<br \/>\n        alias \/var\/www\/django\/static\/;<br \/>\n        expires 30d;<br \/>\n        add_header Cache-Control &#034;public, immutable&#034;;<br \/>\n    }<\/p>\n<p>    # \u5a92\u4f53\u6587\u4ef6<br \/>\n    location \/media\/ {<br \/>\n        alias \/var\/www\/django\/media\/;<br \/>\n        expires 7d;<br \/>\n    }<\/p>\n<p>    # \u5e94\u7528\u4ee3\u7406<br \/>\n    location \/ {<br \/>\n        proxy_pass http:\/\/unix:\/run\/gunicorn\/django.sock;<br \/>\n        proxy_set_header Host $host;<br \/>\n        proxy_set_header X-Real-IP $remote_addr;<br \/>\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br \/>\n        proxy_set_header X-Forwarded-Proto $scheme;<br \/>\n    }<br \/>\n}<\/p>\n<h3>\u7b2c\u56db\u7ae0&#xff1a;Apache HTTPS\u914d\u7f6e\u5b9e\u6218<\/h3>\n<h4>4.1 Apache SSL\u6a21\u5757\u542f\u7528<\/h4>\n<p>\u542f\u7528SSL\u6a21\u5757&#xff1a;<\/p>\n<p><span class=\"token comment\"># Ubuntu\/Debian<\/span><br \/>\n<span class=\"token function\">sudo<\/span> a2enmod ssl<br \/>\n<span class=\"token function\">sudo<\/span> a2enmod headers<br \/>\n<span class=\"token function\">sudo<\/span> a2enmod rewrite<\/p>\n<p><span class=\"token comment\"># CentOS\/RHEL<\/span><br \/>\n<span class=\"token comment\"># SSL\u6a21\u5757\u901a\u5e38\u9ed8\u8ba4\u542f\u7528<\/span><br \/>\n<span class=\"token function\">sudo<\/span> systemctl restart httpd<\/p>\n<h4>4.2 \u865a\u62df\u4e3b\u673aHTTPS\u914d\u7f6e<\/h4>\n<p>\u57fa\u7840\u914d\u7f6e&#xff1a;<\/p>\n<p># HTTP\u91cd\u5b9a\u5411\u914d\u7f6e<br \/>\n&lt;VirtualHost *:80&gt;<br \/>\n    ServerName example.com<br \/>\n    ServerAlias www.example.com<\/p>\n<p>    RewriteEngine On<br \/>\n    RewriteCond %{HTTPS} off<br \/>\n    RewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}%{REQUEST_URI} [R&#061;301,L]<br \/>\n&lt;\/VirtualHost&gt;<\/p>\n<p># HTTPS\u914d\u7f6e<br \/>\n&lt;VirtualHost *:443&gt;<br \/>\n    ServerName example.com<br \/>\n    ServerAlias www.example.com<br \/>\n    DocumentRoot \/var\/www\/html<\/p>\n<p>    # SSL\u5f15\u64ce\u542f\u7528<br \/>\n    SSLEngine on<\/p>\n<p>    # \u8bc1\u4e66\u914d\u7f6e<br \/>\n    SSLCertificateFile \/etc\/letsencrypt\/live\/example.com\/cert.pem<br \/>\n    SSLCertificateKeyFile \/etc\/letsencrypt\/live\/example.com\/privkey.pem<br \/>\n    SSLCertificateChainFile \/etc\/letsencrypt\/live\/example.com\/chain.pem<\/p>\n<p>    # SSL\u534f\u8bae\u914d\u7f6e<br \/>\n    SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1<br \/>\n    SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256<br \/>\n    SSLHonorCipherOrder off<\/p>\n<p>    # \u5b89\u5168\u5934\u90e8<br \/>\n    Header always set Strict-Transport-Security &#034;max-age&#061;31536000; includeSubDomains; preload&#034;<br \/>\n    Header always set X-Frame-Options DENY<br \/>\n    Header always set X-Content-Type-Options nosniff<br \/>\n&lt;\/VirtualHost&gt;<\/p>\n<h4>4.3 Python WSGI\u5e94\u7528HTTPS\u914d\u7f6e<\/h4>\n<p>mod_wsgi\u914d\u7f6e&#xff1a;<\/p>\n<p>&lt;VirtualHost *:443&gt;<br \/>\n    ServerName python.example.com<br \/>\n    DocumentRoot \/var\/www\/python-app<\/p>\n<p>    SSLEngine on<br \/>\n    SSLCertificateFile \/etc\/letsencrypt\/live\/python.example.com\/cert.pem<br \/>\n    SSLCertificateKeyFile \/etc\/letsencrypt\/live\/python.example.com\/privkey.pem<br \/>\n    SSLCertificateChainFile \/etc\/letsencrypt\/live\/python.example.com\/chain.pem<\/p>\n<p>    # WSGI\u914d\u7f6e<br \/>\n    WSGIDaemonProcess python-app python-path&#061;\/var\/www\/python-app<br \/>\n    WSGIProcessGroup python-app<br \/>\n    WSGIScriptAlias \/ \/var\/www\/python-app\/app.wsgi<\/p>\n<p>    &lt;Directory \/var\/www\/python-app&gt;<br \/>\n        WSGIApplicationGroup %{GLOBAL}<br \/>\n        Require all granted<br \/>\n    &lt;\/Directory&gt;<\/p>\n<p>    # \u9759\u6001\u6587\u4ef6<br \/>\n    Alias \/static \/var\/www\/python-app\/static<br \/>\n    &lt;Directory \/var\/www\/python-app\/static&gt;<br \/>\n        Require all granted<br \/>\n    &lt;\/Directory&gt;<br \/>\n&lt;\/VirtualHost&gt;<\/p>\n<h3>\u7b2c\u4e94\u7ae0&#xff1a;HTTPS\u6027\u80fd\u4f18\u5316\u4e0e\u76d1\u63a7<\/h3>\n<h4>5.1 SSL\u6027\u80fd\u4f18\u5316\u7b56\u7565<\/h4>\n<p>1. \u542f\u7528HTTP\/2&#xff1a;<\/p>\n<p># Nginx\u914d\u7f6e<br \/>\nlisten 443 ssl http2;<\/p>\n<p># Apache\u914d\u7f6e<br \/>\nLoadModule http2_module modules\/mod_http2.so<br \/>\nProtocols h2 http\/1.1<\/p>\n<p>2. SSL\u4f1a\u8bdd\u91cd\u7528&#xff1a;<\/p>\n<p># Nginx<br \/>\nssl_session_cache shared:SSL:10m;<br \/>\nssl_session_timeout 10m;<\/p>\n<p># Apache<br \/>\nSSLSessionCache shmcb:\/var\/cache\/mod_ssl\/scache(512000)<br \/>\nSSLSessionCacheTimeout 300<\/p>\n<p>3. OCSP\u88c5\u8ba2&#xff1a;<\/p>\n<p># Nginx<br \/>\nssl_stapling on;<br \/>\nssl_stapling_verify on;<br \/>\nssl_trusted_certificate \/path\/to\/chain.pem;<\/p>\n<p># Apache<br \/>\nSSLUseStapling on<br \/>\nSSLStaplingCache shmcb:\/var\/run\/ocsp(128000)<\/p>\n<h4>5.2 SSL\u8bc1\u4e66\u76d1\u63a7\u811a\u672c<\/h4>\n<p>\u8bc1\u4e66\u5230\u671f\u76d1\u63a7&#xff1a;<\/p>\n<p><span class=\"token comment\">#!\/usr\/bin\/env python3<\/span><br \/>\n<span class=\"token keyword\">import<\/span> ssl<br \/>\n<span class=\"token keyword\">import<\/span> socket<br \/>\n<span class=\"token keyword\">import<\/span> datetime<br \/>\n<span class=\"token keyword\">import<\/span> smtplib<br \/>\n<span class=\"token keyword\">from<\/span> email<span class=\"token punctuation\">.<\/span>mime<span class=\"token punctuation\">.<\/span>text <span class=\"token keyword\">import<\/span> MIMEText<\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">check_ssl_expiry<\/span><span class=\"token punctuation\">(<\/span>hostname<span class=\"token punctuation\">,<\/span> port<span class=\"token operator\">&#061;<\/span><span class=\"token number\">443<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u68c0\u67e5SSL\u8bc1\u4e66\u5230\u671f\u65f6\u95f4&#034;&#034;&#034;<\/span><br \/>\n    <span class=\"token keyword\">try<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token comment\"># \u521b\u5efaSSL\u4e0a\u4e0b\u6587<\/span><br \/>\n        context <span class=\"token operator\">&#061;<\/span> ssl<span class=\"token punctuation\">.<\/span>create_default_context<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>        <span class=\"token comment\"># \u8fde\u63a5\u5230\u670d\u52a1\u5668<\/span><br \/>\n        <span class=\"token keyword\">with<\/span> socket<span class=\"token punctuation\">.<\/span>create_connection<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>hostname<span class=\"token punctuation\">,<\/span> port<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> timeout<span class=\"token operator\">&#061;<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> sock<span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">with<\/span> context<span class=\"token punctuation\">.<\/span>wrap_socket<span class=\"token punctuation\">(<\/span>sock<span class=\"token punctuation\">,<\/span> server_hostname<span class=\"token operator\">&#061;<\/span>hostname<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> ssock<span class=\"token punctuation\">:<\/span><br \/>\n                <span class=\"token comment\"># \u83b7\u53d6\u8bc1\u4e66\u4fe1\u606f<\/span><br \/>\n                cert <span class=\"token operator\">&#061;<\/span> ssock<span class=\"token punctuation\">.<\/span>getpeercert<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>                <span class=\"token comment\"># \u89e3\u6790\u5230\u671f\u65f6\u95f4<\/span><br \/>\n                expiry_date <span class=\"token operator\">&#061;<\/span> datetime<span class=\"token punctuation\">.<\/span>datetime<span class=\"token punctuation\">.<\/span>strptime<span class=\"token punctuation\">(<\/span><br \/>\n                    cert<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;notAfter&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;%b %d %H:%M:%S %Y %Z&#039;<\/span><br \/>\n                <span class=\"token punctuation\">)<\/span><\/p>\n<p>                <span class=\"token comment\"># \u8ba1\u7b97\u5269\u4f59\u5929\u6570<\/span><br \/>\n                days_left <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">(<\/span>expiry_date <span class=\"token operator\">&#8211;<\/span> datetime<span class=\"token punctuation\">.<\/span>datetime<span class=\"token punctuation\">.<\/span>now<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>days<\/p>\n<p>                <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                    <span class=\"token string\">&#039;hostname&#039;<\/span><span class=\"token punctuation\">:<\/span> hostname<span class=\"token punctuation\">,<\/span><br \/>\n                    <span class=\"token string\">&#039;expiry_date&#039;<\/span><span class=\"token punctuation\">:<\/span> expiry_date<span class=\"token punctuation\">,<\/span><br \/>\n                    <span class=\"token string\">&#039;days_left&#039;<\/span><span class=\"token punctuation\">:<\/span> days_left<span class=\"token punctuation\">,<\/span><br \/>\n                    <span class=\"token string\">&#039;issuer&#039;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">dict<\/span><span class=\"token punctuation\">(<\/span>x<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">for<\/span> x <span class=\"token keyword\">in<\/span> cert<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;issuer&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                    <span class=\"token string\">&#039;subject&#039;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">dict<\/span><span class=\"token punctuation\">(<\/span>x<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">for<\/span> x <span class=\"token keyword\">in<\/span> cert<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;subject&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n                <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">except<\/span> Exception <span class=\"token keyword\">as<\/span> e<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token string\">&#039;hostname&#039;<\/span><span class=\"token punctuation\">:<\/span> hostname<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;error&#039;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">(<\/span>e<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">send_alert<\/span><span class=\"token punctuation\">(<\/span>cert_info<span class=\"token punctuation\">,<\/span> threshold<span class=\"token operator\">&#061;<\/span><span class=\"token number\">30<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u53d1\u9001\u544a\u8b66\u90ae\u4ef6&#034;&#034;&#034;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> cert_info<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;days_left&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&lt;<\/span> threshold<span class=\"token punctuation\">:<\/span><br \/>\n        subject <span class=\"token operator\">&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;SSL\u8bc1\u4e66\u5373\u5c06\u8fc7\u671f: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>cert_info<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;hostname&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><br \/>\n        body <span class=\"token operator\">&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;&#034;&#034;<br \/>\n        \u57df\u540d: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>cert_info<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;hostname&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"><br \/>\n        \u5230\u671f\u65f6\u95f4: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>cert_info<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;expiry_date&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"><br \/>\n        \u5269\u4f59\u5929\u6570: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>cert_info<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;days_left&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"><br \/>\n        \u9881\u53d1\u8005: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>cert_info<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;issuer&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;organizationName&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;Unknown&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"><br \/>\n        &#034;&#034;&#034;<\/span><\/span><\/p>\n<p>        <span class=\"token comment\"># \u53d1\u9001\u90ae\u4ef6\u903b\u8f91<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u544a\u8b66: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>subject<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span>body<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u76d1\u63a7\u57df\u540d\u5217\u8868<\/span><br \/>\ndomains <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n    <span class=\"token string\">&#039;example.com&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#039;api.example.com&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#039;admin.example.com&#039;<\/span><br \/>\n<span class=\"token punctuation\">]<\/span><\/p>\n<p><span class=\"token comment\"># \u68c0\u67e5\u6240\u6709\u57df\u540d<\/span><br \/>\n<span class=\"token keyword\">for<\/span> domain <span class=\"token keyword\">in<\/span> domains<span class=\"token punctuation\">:<\/span><br \/>\n    cert_info <span class=\"token operator\">&#061;<\/span> check_ssl_expiry<span class=\"token punctuation\">(<\/span>domain<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token string\">&#039;error&#039;<\/span> <span class=\"token keyword\">not<\/span> <span class=\"token keyword\">in<\/span> cert_info<span class=\"token punctuation\">:<\/span><br \/>\n        send_alert<span class=\"token punctuation\">(<\/span>cert_info<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>domain<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>cert_info<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;days_left&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> days left&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">else<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>domain<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">: Error &#8211; <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>cert_info<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;error&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h4>5.3 SSL\u914d\u7f6e\u5b89\u5168\u8bc4\u4f30<\/h4>\n<p>\u4f7f\u7528SSL Labs\u6d4b\u8bd5&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u5728\u7ebf\u6d4b\u8bd5<\/span><br \/>\n<span class=\"token comment\"># https:\/\/www.ssllabs.com\/ssltest\/<\/span><\/p>\n<p><span class=\"token comment\"># \u547d\u4ee4\u884c\u6d4b\u8bd5<\/span><br \/>\n<span class=\"token function\">curl<\/span> -s <span class=\"token string\">&#034;https:\/\/api.ssllabs.com\/api\/v3\/analyze?host&#061;example.com&#034;<\/span> <span class=\"token operator\">|<\/span> jq<\/p>\n<p>\u672c\u5730SSL\u914d\u7f6e\u6d4b\u8bd5&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u6d4b\u8bd5SSL\u8fde\u63a5<\/span><br \/>\nopenssl s_client -connect example.com:443 -servername example.com<\/p>\n<p><span class=\"token comment\"># \u68c0\u67e5\u8bc1\u4e66\u4fe1\u606f<\/span><br \/>\nopenssl x509 -in \/etc\/letsencrypt\/live\/example.com\/cert.pem -text -noout<\/p>\n<p><span class=\"token comment\"># \u6d4b\u8bd5SSL\u63e1\u624b<\/span><br \/>\nnmap &#8211;script ssl-enum-ciphers -p <span class=\"token number\">443<\/span> example.com<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729201716-68892c4ce962d.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>\u7b2c\u516d\u7ae0&#xff1a;\u5e38\u89c1\u95ee\u9898\u6392\u67e5\u4e0e\u89e3\u51b3<\/h3>\n<h4>6.1 \u8bc1\u4e66\u76f8\u5173\u95ee\u9898<\/h4>\n<p>\u95ee\u98981&#xff1a;\u8bc1\u4e66\u94fe\u4e0d\u5b8c\u6574<\/p>\n<p><span class=\"token comment\"># \u75c7\u72b6&#xff1a;\u6d4f\u89c8\u5668\u663e\u793a\u8bc1\u4e66\u9519\u8bef<\/span><br \/>\n<span class=\"token comment\"># \u89e3\u51b3&#xff1a;\u68c0\u67e5\u8bc1\u4e66\u94fe<\/span><br \/>\nopenssl verify -CApath \/etc\/ssl\/certs\/ \/etc\/letsencrypt\/live\/example.com\/cert.pem<\/p>\n<p><span class=\"token comment\"># \u4f7f\u7528\u5b8c\u6574\u8bc1\u4e66\u94fe<\/span><br \/>\nssl_certificate \/etc\/letsencrypt\/live\/example.com\/fullchain.pem<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u95ee\u98982&#xff1a;\u8bc1\u4e66\u8fc7\u671f<\/p>\n<p><span class=\"token comment\"># \u68c0\u67e5\u8bc1\u4e66\u6709\u6548\u671f<\/span><br \/>\nopenssl x509 -in \/etc\/letsencrypt\/live\/example.com\/cert.pem -dates -noout<\/p>\n<p><span class=\"token comment\"># \u624b\u52a8\u7eed\u671f<\/span><br \/>\n<span class=\"token function\">sudo<\/span> certbot renew &#8211;force-renewal<\/p>\n<p>\u95ee\u98983&#xff1a;SNI\u914d\u7f6e\u9519\u8bef<\/p>\n<p># \u786e\u4fddserver_name\u6b63\u786e<br \/>\nserver {<br \/>\n    listen 443 ssl;<br \/>\n    server_name example.com;  # \u5fc5\u987b\u4e0e\u8bc1\u4e66\u57df\u540d\u5339\u914d<\/p>\n<p>    ssl_certificate \/path\/to\/cert.pem;<br \/>\n    ssl_certificate_key \/path\/to\/key.pem;<br \/>\n}<\/p>\n<h4>6.2 \u6027\u80fd\u95ee\u9898\u6392\u67e5<\/h4>\n<p>\u95ee\u98981&#xff1a;SSL\u63e1\u624b\u6162<\/p>\n<p><span class=\"token comment\"># \u6d4b\u8bd5\u63e1\u624b\u65f6\u95f4<\/span><br \/>\n<span class=\"token function\">curl<\/span> -w <span class=\"token string\">&#034;&#064;curl-format.txt&#034;<\/span> -o \/dev\/null -s <span class=\"token string\">&#034;https:\/\/example.com\/&#034;<\/span><\/p>\n<p><span class=\"token comment\"># curl-format.txt\u5185\u5bb9&#xff1a;<\/span><br \/>\n<span class=\"token comment\">#     time_namelookup:  %{time_namelookup}\\\\n<\/span><br \/>\n<span class=\"token comment\">#        time_connect:  %{time_connect}\\\\n<\/span><br \/>\n<span class=\"token comment\">#     time_appconnect:  %{time_appconnect}\\\\n<\/span><br \/>\n<span class=\"token comment\">#    time_pretransfer:  %{time_pretransfer}\\\\n<\/span><\/p>\n<p>\u95ee\u98982&#xff1a;\u4f1a\u8bdd\u91cd\u7528\u5931\u6548<\/p>\n<p># \u68c0\u67e5\u4f1a\u8bdd\u7f13\u5b58\u914d\u7f6e<br \/>\nssl_session_cache shared:SSL:10m;<br \/>\nssl_session_timeout 10m;<\/p>\n<p># \u9a8c\u8bc1\u4f1a\u8bdd\u91cd\u7528<br \/>\nopenssl s_client -connect example.com:443 -sess_out session.pem<br \/>\nopenssl s_client -connect example.com:443 -sess_in session.pem<\/p>\n<h4>6.3 \u914d\u7f6e\u9a8c\u8bc1\u811a\u672c<\/h4>\n<p>HTTPS\u914d\u7f6e\u68c0\u67e5\u811a\u672c&#xff1a;<\/p>\n<p><span class=\"token comment\">#!\/usr\/bin\/env python3<\/span><br \/>\n<span class=\"token keyword\">import<\/span> requests<br \/>\n<span class=\"token keyword\">import<\/span> ssl<br \/>\n<span class=\"token keyword\">import<\/span> socket<br \/>\n<span class=\"token keyword\">from<\/span> urllib<span class=\"token punctuation\">.<\/span>parse <span class=\"token keyword\">import<\/span> urlparse<\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">check_https_config<\/span><span class=\"token punctuation\">(<\/span>url<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u68c0\u67e5HTTPS\u914d\u7f6e&#034;&#034;&#034;<\/span><br \/>\n    <span class=\"token keyword\">try<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token comment\"># \u89e3\u6790URL<\/span><br \/>\n        parsed <span class=\"token operator\">&#061;<\/span> urlparse<span class=\"token punctuation\">(<\/span>url<span class=\"token punctuation\">)<\/span><br \/>\n        hostname <span class=\"token operator\">&#061;<\/span> parsed<span class=\"token punctuation\">.<\/span>hostname<br \/>\n        port <span class=\"token operator\">&#061;<\/span> parsed<span class=\"token punctuation\">.<\/span>port <span class=\"token keyword\">or<\/span> <span class=\"token number\">443<\/span><\/p>\n<p>        <span class=\"token comment\"># \u68c0\u67e5HTTP\u91cd\u5b9a\u5411<\/span><br \/>\n        http_response <span class=\"token operator\">&#061;<\/span> requests<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;http:\/\/<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>hostname<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">,<\/span> allow_redirects<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">False<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        redirect_ok <span class=\"token operator\">&#061;<\/span> http_response<span class=\"token punctuation\">.<\/span>status_code <span class=\"token keyword\">in<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token number\">301<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">302<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">307<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">308<\/span><span class=\"token punctuation\">]<\/span><\/p>\n<p>        <span class=\"token comment\"># \u68c0\u67e5HTTPS\u8fde\u63a5<\/span><br \/>\n        https_response <span class=\"token operator\">&#061;<\/span> requests<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span>url<span class=\"token punctuation\">,<\/span> timeout<span class=\"token operator\">&#061;<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        https_ok <span class=\"token operator\">&#061;<\/span> https_response<span class=\"token punctuation\">.<\/span>status_code <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">200<\/span><\/p>\n<p>        <span class=\"token comment\"># \u68c0\u67e5\u5b89\u5168\u5934\u90e8<\/span><br \/>\n        headers <span class=\"token operator\">&#061;<\/span> https_response<span class=\"token punctuation\">.<\/span>headers<br \/>\n        security_headers <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token string\">&#039;Strict-Transport-Security&#039;<\/span><span class=\"token punctuation\">:<\/span> headers<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;Strict-Transport-Security&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#039;X-Frame-Options&#039;<\/span><span class=\"token punctuation\">:<\/span> headers<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;X-Frame-Options&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#039;X-Content-Type-Options&#039;<\/span><span class=\"token punctuation\">:<\/span> headers<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;X-Content-Type-Options&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#039;X-XSS-Protection&#039;<\/span><span class=\"token punctuation\">:<\/span> headers<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;X-XSS-Protection&#039;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><\/p>\n<p>        <span class=\"token comment\"># \u68c0\u67e5SSL\u8bc1\u4e66<\/span><br \/>\n        context <span class=\"token operator\">&#061;<\/span> ssl<span class=\"token punctuation\">.<\/span>create_default_context<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">with<\/span> socket<span class=\"token punctuation\">.<\/span>create_connection<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>hostname<span class=\"token punctuation\">,<\/span> port<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> sock<span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">with<\/span> context<span class=\"token punctuation\">.<\/span>wrap_socket<span class=\"token punctuation\">(<\/span>sock<span class=\"token punctuation\">,<\/span> server_hostname<span class=\"token operator\">&#061;<\/span>hostname<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> ssock<span class=\"token punctuation\">:<\/span><br \/>\n                cert <span class=\"token operator\">&#061;<\/span> ssock<span class=\"token punctuation\">.<\/span>getpeercert<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>        <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token string\">&#039;url&#039;<\/span><span class=\"token punctuation\">:<\/span> url<span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#039;http_redirect&#039;<\/span><span class=\"token punctuation\">:<\/span> redirect_ok<span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#039;https_accessible&#039;<\/span><span class=\"token punctuation\">:<\/span> https_ok<span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#039;security_headers&#039;<\/span><span class=\"token punctuation\">:<\/span> security_headers<span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#039;ssl_cert&#039;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                <span class=\"token string\">&#039;subject&#039;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">dict<\/span><span class=\"token punctuation\">(<\/span>x<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">for<\/span> x <span class=\"token keyword\">in<\/span> cert<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;subject&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                <span class=\"token string\">&#039;issuer&#039;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">dict<\/span><span class=\"token punctuation\">(<\/span>x<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">for<\/span> x <span class=\"token keyword\">in<\/span> cert<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;issuer&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                <span class=\"token string\">&#039;version&#039;<\/span><span class=\"token punctuation\">:<\/span> cert<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;version&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                <span class=\"token string\">&#039;serial_number&#039;<\/span><span class=\"token punctuation\">:<\/span> cert<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;serialNumber&#039;<\/span><span class=\"token punctuation\">]<\/span><br \/>\n            <span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">except<\/span> Exception <span class=\"token keyword\">as<\/span> e<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token string\">&#039;url&#039;<\/span><span class=\"token punctuation\">:<\/span> url<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;error&#039;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">(<\/span>e<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\"># \u6d4b\u8bd5\u7f51\u7ad9\u5217\u8868<\/span><br \/>\nwebsites <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n    <span class=\"token string\">&#039;https:\/\/example.com&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#039;https:\/\/api.example.com&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#039;https:\/\/admin.example.com&#039;<\/span><br \/>\n<span class=\"token punctuation\">]<\/span><\/p>\n<p><span class=\"token keyword\">for<\/span> site <span class=\"token keyword\">in<\/span> websites<span class=\"token punctuation\">:<\/span><br \/>\n    result <span class=\"token operator\">&#061;<\/span> check_https_config<span class=\"token punctuation\">(<\/span>site<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\\\\n\u68c0\u67e5\u7ed3\u679c: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>site<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token keyword\">if<\/span> <span class=\"token string\">&#039;error&#039;<\/span> <span class=\"token keyword\">in<\/span> result<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u9519\u8bef: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>result<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;error&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">else<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;HTTP\u91cd\u5b9a\u5411: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span><span class=\"token string\">&#039;\u2713&#039;<\/span> <span class=\"token keyword\">if<\/span> result<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;http_redirect&#039;<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token string\">&#039;\u2717&#039;<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;HTTPS\u8bbf\u95ee: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span><span class=\"token string\">&#039;\u2713&#039;<\/span> <span class=\"token keyword\">if<\/span> result<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;https_accessible&#039;<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token string\">&#039;\u2717&#039;<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u5b89\u5168\u5934\u90e8: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>result<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;security_headers&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;SSL\u8bc1\u4e66: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>result<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;ssl_cert&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;subject&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h3>\u7b2c\u4e03\u7ae0&#xff1a;\u4f01\u4e1a\u7ea7HTTPS\u6700\u4f73\u5b9e\u8df5<\/h3>\n<h4>7.1 \u591a\u57df\u540d\u8bc1\u4e66\u7ba1\u7406<\/h4>\n<p>\u901a\u914d\u7b26\u8bc1\u4e66\u914d\u7f6e&#xff1a;<\/p>\n<p># \u4e3b\u57df\u540d\u914d\u7f6e<br \/>\nserver {<br \/>\n    listen 443 ssl http2;<br \/>\n    server_name example.com *.example.com;<\/p>\n<p>    ssl_certificate \/etc\/letsencrypt\/live\/example.com\/fullchain.pem;<br \/>\n    ssl_certificate_key \/etc\/letsencrypt\/live\/example.com\/privkey.pem;<\/p>\n<p>    # \u6839\u636e\u5b50\u57df\u540d\u5206\u53d1\u8bf7\u6c42<br \/>\n    location \/ {<br \/>\n        if ($host &#061; &#034;api.example.com&#034;) {<br \/>\n            proxy_pass http:\/\/api_backend;<br \/>\n        }<br \/>\n        if ($host &#061; &#034;admin.example.com&#034;) {<br \/>\n            proxy_pass http:\/\/admin_backend;<br \/>\n        }<br \/>\n        # \u9ed8\u8ba4\u4e3b\u7ad9<br \/>\n        root \/var\/www\/html;<br \/>\n    }<br \/>\n}<\/p>\n<h4>7.2 SSL\u8bc1\u4e66\u81ea\u52a8\u5316\u7ba1\u7406<\/h4>\n<p>Docker\u5316\u8bc1\u4e66\u7ba1\u7406&#xff1a;<\/p>\n<p><span class=\"token comment\"># docker-compose.yml<\/span><br \/>\n<span class=\"token key atrule\">version<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#039;3.8&#039;<\/span><br \/>\n<span class=\"token key atrule\">services<\/span><span class=\"token punctuation\">:<\/span><br \/>\n  <span class=\"token key atrule\">certbot<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token key atrule\">image<\/span><span class=\"token punctuation\">:<\/span> certbot\/certbot<br \/>\n    <span class=\"token key atrule\">volumes<\/span><span class=\"token punctuation\">:<\/span><br \/>\n      <span class=\"token punctuation\">&#8211;<\/span> .\/letsencrypt<span class=\"token punctuation\">:<\/span>\/etc\/letsencrypt<br \/>\n      <span class=\"token punctuation\">&#8211;<\/span> .\/webroot<span class=\"token punctuation\">:<\/span>\/var\/www\/html<br \/>\n    <span class=\"token key atrule\">command<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">&gt;<\/span><span class=\"token scalar string\"><br \/>\n      certonly &#8211;webroot<br \/>\n      &#8211;webroot-path&#061;\/var\/www\/html<br \/>\n      &#8211;email admin&#064;example.com<br \/>\n      &#8211;agree-tos<br \/>\n      &#8211;no-eff-email<br \/>\n      -d example.com<br \/>\n      -d www.example.com<\/span><\/p>\n<p>  <span class=\"token key atrule\">nginx<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token key atrule\">image<\/span><span class=\"token punctuation\">:<\/span> nginx<span class=\"token punctuation\">:<\/span>alpine<br \/>\n    <span class=\"token key atrule\">ports<\/span><span class=\"token punctuation\">:<\/span><br \/>\n      <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token string\">&#034;80:80&#034;<\/span><br \/>\n      <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token string\">&#034;443:443&#034;<\/span><br \/>\n    <span class=\"token key atrule\">volumes<\/span><span class=\"token punctuation\">:<\/span><br \/>\n      <span class=\"token punctuation\">&#8211;<\/span> .\/nginx.conf<span class=\"token punctuation\">:<\/span>\/etc\/nginx\/nginx.conf<br \/>\n      <span class=\"token punctuation\">&#8211;<\/span> .\/letsencrypt<span class=\"token punctuation\">:<\/span>\/etc\/letsencrypt<br \/>\n      <span class=\"token punctuation\">&#8211;<\/span> .\/webroot<span class=\"token punctuation\">:<\/span>\/var\/www\/html<br \/>\n    <span class=\"token key atrule\">depends_on<\/span><span class=\"token punctuation\">:<\/span><br \/>\n      <span class=\"token punctuation\">&#8211;<\/span> certbot<\/p>\n<h4>7.3 HTTPS\u5b89\u5168\u52a0\u56fa<\/h4>\n<p>\u5b8c\u6574\u7684\u5b89\u5168\u914d\u7f6e&#xff1a;<\/p>\n<p># \u5168\u5c40SSL\u914d\u7f6e<br \/>\nssl_protocols TLSv1.2 TLSv1.3;<br \/>\nssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;<br \/>\nssl_prefer_server_ciphers off;<\/p>\n<p># \u4f1a\u8bdd\u914d\u7f6e<br \/>\nssl_session_cache shared:SSL:10m;<br \/>\nssl_session_timeout 10m;<br \/>\nssl_session_tickets off;<\/p>\n<p># OCSP\u88c5\u8ba2<br \/>\nssl_stapling on;<br \/>\nssl_stapling_verify on;<\/p>\n<p># \u5b89\u5168\u5934\u90e8<br \/>\nadd_header Strict-Transport-Security &#034;max-age&#061;31536000; includeSubDomains; preload&#034; always;<br \/>\nadd_header X-Frame-Options DENY always;<br \/>\nadd_header X-Content-Type-Options nosniff always;<br \/>\nadd_header X-XSS-Protection &#034;1; mode&#061;block&#034; always;<br \/>\nadd_header Referrer-Policy &#034;strict-origin-when-cross-origin&#034; always;<br \/>\nadd_header Content-Security-Policy &#034;default-src &#039;self&#039;; script-src &#039;self&#039; &#039;unsafe-inline&#039;; style-src &#039;self&#039; &#039;unsafe-inline&#039;;&#034; always;<\/p>\n<p># \u9690\u85cf\u670d\u52a1\u5668\u4fe1\u606f<br \/>\nserver_tokens off;<\/p>\n<h3>\u7ed3\u8bed&#xff1a;\u6784\u5efa\u4f01\u4e1a\u7ea7HTTPS\u5b89\u5168\u9632\u62a4\u4f53\u7cfb<\/h3>\n<p>\u901a\u8fc7\u672c\u6587\u7684\u6df1\u5165\u8bb2\u89e3&#xff0c;\u6211\u4eec\u5df2\u7ecf\u638c\u63e1\u4e86HTTPS\u914d\u7f6e\u7684\u5b8c\u6574\u6d41\u7a0b&#xff1a;<\/p>\n<li>\u7406\u89e3HTTPS\u539f\u7406&#xff1a;\u4ece\u63e1\u624b\u8fc7\u7a0b\u5230\u52a0\u5bc6\u673a\u5236\u7684\u6df1\u5ea6\u89e3\u6790<\/li>\n<li>\u8bc1\u4e66\u7533\u8bf7\u7ba1\u7406&#xff1a;\u4ece\u514d\u8d39Let\u2019s Encrypt\u5230\u4f01\u4e1a\u7ea7\u8bc1\u4e66\u7684\u9009\u62e9<\/li>\n<li>\u670d\u52a1\u5668\u914d\u7f6e&#xff1a;Nginx\u548cApache\u7684HTTPS\u914d\u7f6e\u5b9e\u6218<\/li>\n<li>\u6027\u80fd\u4f18\u5316&#xff1a;SSL\u4f18\u5316\u7b56\u7565\u548c\u76d1\u63a7\u65b9\u6848<\/li>\n<li>\u95ee\u9898\u6392\u67e5&#xff1a;\u5e38\u89c1\u95ee\u9898\u7684\u8bca\u65ad\u548c\u89e3\u51b3\u65b9\u6cd5<\/li>\n<li>\u6700\u4f73\u5b9e\u8df5&#xff1a;\u4f01\u4e1a\u7ea7HTTPS\u5b89\u5168\u52a0\u56fa\u65b9\u6848<\/li>\n<p>HTTPS\u4e0d\u4ec5\u4ec5\u662f\u4e00\u4e2a\u6280\u672f\u914d\u7f6e&#xff0c;\u66f4\u662f\u73b0\u4ee3Web\u5e94\u7528\u5b89\u5168\u7684\u57fa\u77f3\u3002\u6b63\u786e\u914d\u7f6eHTTPS\u53ef\u4ee5&#xff1a;<\/p>\n<ul>\n<li>\u63d0\u5347\u7528\u6237\u4fe1\u4efb\u5ea6&#xff1a;\u7eff\u8272\u9501\u5934\u8ba9\u7528\u6237\u66f4\u6709\u5b89\u5168\u611f<\/li>\n<li>\u4fdd\u62a4\u654f\u611f\u6570\u636e&#xff1a;\u52a0\u5bc6\u4f20\u8f93\u9632\u6b62\u6570\u636e\u6cc4\u9732<\/li>\n<li>\u6539\u5584SEO\u6392\u540d&#xff1a;\u641c\u7d22\u5f15\u64ce\u66f4\u504f\u7231HTTPS\u7f51\u7ad9<\/li>\n<li>\u7b26\u5408\u5408\u89c4\u8981\u6c42&#xff1a;\u6ee1\u8db3\u5404\u79cd\u5b89\u5168\u6807\u51c6\u548c\u6cd5\u89c4<\/li>\n<\/ul>\n<p>\u8bb0\u4f4f&#xff0c;\u5b89\u5168\u662f\u4e00\u4e2a\u6301\u7eed\u7684\u8fc7\u7a0b&#xff0c;\u800c\u4e0d\u662f\u4e00\u6b21\u6027\u7684\u914d\u7f6e\u3002\u5b9a\u671f\u66f4\u65b0\u8bc1\u4e66\u3001\u76d1\u63a7\u5b89\u5168\u72b6\u6001\u3001\u4f18\u5316\u914d\u7f6e\u53c2\u6570&#xff0c;\u8fd9\u4e9b\u90fd\u662f\u7ef4\u62a4HTTPS\u5b89\u5168\u7684\u91cd\u8981\u73af\u8282\u3002<\/p>\n<p>\u5728\u4e0b\u4e00\u7bc7\u6587\u7ae0\u4e2d&#xff0c;\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8API\u7f51\u5173\u7684\u90e8\u7f72\u4e0e\u914d\u7f6e&#xff0c;\u5b66\u4e60\u5982\u4f55\u6784\u5efa\u5fae\u670d\u52a1\u67b6\u6784\u4e0b\u7684\u7edf\u4e00\u5165\u53e3\u3002<\/p>\n<h3>\u53c2\u8003\u8d44\u6599<\/h3>\n<li>Let\u2019s Encrypt\u5b98\u65b9\u6587\u6863<\/li>\n<li>Mozilla SSL\u914d\u7f6e\u751f\u6210\u5668<\/li>\n<li>SSL Labs\u6d4b\u8bd5\u5de5\u5177<\/li>\n<li>OWASP TLS\u5b89\u5168\u6307\u5357<\/li>\n<li>RFC 8446 &#8211; TLS 1.3\u534f\u8bae<\/li>\n<li>Nginx SSL\u6a21\u5757\u6587\u6863<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.8k\u6b21\uff0c\u70b9\u8d5e41\u6b21\uff0c\u6536\u85cf35\u6b21\u3002\u672c\u6587\u4ece\u96f6\u5f00\u59cb\u8bb2\u89e3HTTPS\u914d\u7f6e\u7684\u5b8c\u6574\u6d41\u7a0b\uff0c\u901a\u8fc7\u5b9e\u9645\u6848\u4f8b\u6f14\u793a\u5982\u4f55\u5728Nginx\u548cApache\u670d\u52a1\u5668\u4e0a\u914d\u7f6eSSL\u8bc1\u4e66\uff0c\u5b9e\u73b0Web\u5e94\u7528\u7684\u5b89\u5168\u4f20\u8f93\u3002\u6db5\u76d6\u8bc1\u4e66\u7533\u8bf7\u3001\u914d\u7f6e\u4f18\u5316\u3001\u5b89\u5168\u52a0\u56fa\u7b49\u6838\u5fc3\u6280\u672f\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u6784\u5efa\u4f01\u4e1a\u7ea7\u7684HTTPS\u5b89\u5168\u9632\u62a4\u4f53\u7cfb\u3002<\/p>\n","protected":false},"author":2,"featured_media":46804,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[622,87,4392,43,782],"topic":[],"class_list":["post-46808","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-https","tag-87","tag-4392","tag-43","tag-782"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010\u670d\u52a1\u5668\u4e0e\u90e8\u7f72 23\u3011HTTPS\u914d\u7f6e\u5b9e\u6218\uff1aWeb\u5e94\u7528\u5b89\u5168\u4f20\u8f93\u534f\u8bae\u914d\u7f6e\u8ba9\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u63d0\u534710\u500d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/46808.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u670d\u52a1\u5668\u4e0e\u90e8\u7f72 23\u3011HTTPS\u914d\u7f6e\u5b9e\u6218\uff1aWeb\u5e94\u7528\u5b89\u5168\u4f20\u8f93\u534f\u8bae\u914d\u7f6e\u8ba9\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u63d0\u534710\u500d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.8k\u6b21\uff0c\u70b9\u8d5e41\u6b21\uff0c\u6536\u85cf35\u6b21\u3002\u672c\u6587\u4ece\u96f6\u5f00\u59cb\u8bb2\u89e3HTTPS\u914d\u7f6e\u7684\u5b8c\u6574\u6d41\u7a0b\uff0c\u901a\u8fc7\u5b9e\u9645\u6848\u4f8b\u6f14\u793a\u5982\u4f55\u5728Nginx\u548cApache\u670d\u52a1\u5668\u4e0a\u914d\u7f6eSSL\u8bc1\u4e66\uff0c\u5b9e\u73b0Web\u5e94\u7528\u7684\u5b89\u5168\u4f20\u8f93\u3002\u6db5\u76d6\u8bc1\u4e66\u7533\u8bf7\u3001\u914d\u7f6e\u4f18\u5316\u3001\u5b89\u5168\u52a0\u56fa\u7b49\u6838\u5fc3\u6280\u672f\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u6784\u5efa\u4f01\u4e1a\u7ea7\u7684HTTPS\u5b89\u5168\u9632\u62a4\u4f53\u7cfb\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/46808.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-29T20:17:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729201714-68892c4a5acb5.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/46808.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/46808.html\",\"name\":\"\u3010\u670d\u52a1\u5668\u4e0e\u90e8\u7f72 23\u3011HTTPS\u914d\u7f6e\u5b9e\u6218\uff1aWeb\u5e94\u7528\u5b89\u5168\u4f20\u8f93\u534f\u8bae\u914d\u7f6e\u8ba9\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u63d0\u534710\u500d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-29T20:17:19+00:00\",\"dateModified\":\"2025-07-29T20:17:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/46808.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/46808.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/46808.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u670d\u52a1\u5668\u4e0e\u90e8\u7f72 23\u3011HTTPS\u914d\u7f6e\u5b9e\u6218\uff1aWeb\u5e94\u7528\u5b89\u5168\u4f20\u8f93\u534f\u8bae\u914d\u7f6e\u8ba9\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u63d0\u534710\u500d\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010\u670d\u52a1\u5668\u4e0e\u90e8\u7f72 23\u3011HTTPS\u914d\u7f6e\u5b9e\u6218\uff1aWeb\u5e94\u7528\u5b89\u5168\u4f20\u8f93\u534f\u8bae\u914d\u7f6e\u8ba9\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u63d0\u534710\u500d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/46808.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u670d\u52a1\u5668\u4e0e\u90e8\u7f72 23\u3011HTTPS\u914d\u7f6e\u5b9e\u6218\uff1aWeb\u5e94\u7528\u5b89\u5168\u4f20\u8f93\u534f\u8bae\u914d\u7f6e\u8ba9\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u63d0\u534710\u500d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.8k\u6b21\uff0c\u70b9\u8d5e41\u6b21\uff0c\u6536\u85cf35\u6b21\u3002\u672c\u6587\u4ece\u96f6\u5f00\u59cb\u8bb2\u89e3HTTPS\u914d\u7f6e\u7684\u5b8c\u6574\u6d41\u7a0b\uff0c\u901a\u8fc7\u5b9e\u9645\u6848\u4f8b\u6f14\u793a\u5982\u4f55\u5728Nginx\u548cApache\u670d\u52a1\u5668\u4e0a\u914d\u7f6eSSL\u8bc1\u4e66\uff0c\u5b9e\u73b0Web\u5e94\u7528\u7684\u5b89\u5168\u4f20\u8f93\u3002\u6db5\u76d6\u8bc1\u4e66\u7533\u8bf7\u3001\u914d\u7f6e\u4f18\u5316\u3001\u5b89\u5168\u52a0\u56fa\u7b49\u6838\u5fc3\u6280\u672f\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u6784\u5efa\u4f01\u4e1a\u7ea7\u7684HTTPS\u5b89\u5168\u9632\u62a4\u4f53\u7cfb\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/46808.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-29T20:17:19+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729201714-68892c4a5acb5.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"10 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/46808.html","url":"https:\/\/www.wsisp.com\/helps\/46808.html","name":"\u3010\u670d\u52a1\u5668\u4e0e\u90e8\u7f72 23\u3011HTTPS\u914d\u7f6e\u5b9e\u6218\uff1aWeb\u5e94\u7528\u5b89\u5168\u4f20\u8f93\u534f\u8bae\u914d\u7f6e\u8ba9\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u63d0\u534710\u500d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-29T20:17:19+00:00","dateModified":"2025-07-29T20:17:19+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/46808.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/46808.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/46808.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010\u670d\u52a1\u5668\u4e0e\u90e8\u7f72 23\u3011HTTPS\u914d\u7f6e\u5b9e\u6218\uff1aWeb\u5e94\u7528\u5b89\u5168\u4f20\u8f93\u534f\u8bae\u914d\u7f6e\u8ba9\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u63d0\u534710\u500d"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/46808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=46808"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/46808\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/46804"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=46808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=46808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=46808"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=46808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}