{"id":394,"date":"2022-05-06T18:51:36","date_gmt":"2022-05-06T10:51:36","guid":{"rendered":"https:\/\/www.onwith.net\/?p=394"},"modified":"2022-05-06T18:51:36","modified_gmt":"2022-05-06T10:51:36","slug":"%e5%a6%82%e4%bd%95%e5%b0%86%e5%9f%9f%e5%90%8d%e6%8f%90%e4%ba%a4%e5%88%b0hsts%e9%a2%84%e5%8a%a0%e8%bd%bd%e5%88%97%e8%a1%a8%ef%bc%8c%e4%bb%a5%e6%8f%90%e5%8d%87%e8%ae%bf%e9%97%ae%e9%80%9f%e5%ba%a6","status":"publish","type":"post","link":"https:\/\/www.onwith.net\/index.php\/394.html","title":{"rendered":"\u5982\u4f55\u5c06\u57df\u540d\u63d0\u4ea4\u5230HSTS\u9884\u52a0\u8f7d\u5217\u8868\uff0c\u4ee5\u63d0\u5347\u8bbf\u95ee\u901f\u5ea6"},"content":{"rendered":"<h2 id=\"h-hsts\">\u4ec0\u4e48\u662fHSTS\u9884\u52a0\u8f7d\u5217\u8868<\/h2>\n<p>HTTP Strict Transport Security\u00a0\u7ffb\u8bd1\u8fc7\u6765\u662f\uff1a\u201cHTTP\u4e25\u683c\u5b89\u5168\u6027\u4f20\u8f93\u201d\uff0c\u7b80\u79f0\uff1aHSTS\u3002\u5b83\u662f\u4e00\u79cdWeb\u5b89\u5168\u7b56\u7565\u673a\u5236\uff0c\u53ef\u5e2e\u52a9\u4fdd\u62a4\u7f51\u7ad9\u514d\u53d7\u4e2d\u95f4\u4eba\u653b\u51fb\uff0c\u4f8b\u5982\u534f\u8bae\u964d\u7ea7\u653b\u51fb\u548ccookie\u52ab\u6301\u3002 \u5b83\u5141\u8bb8Web\u670d\u52a1\u5668\u58f0\u660eWeb\u6d4f\u89c8\u5668\uff08\u6216\u5176\u4ed6\u7b26\u5408\u8981\u6c42\u7684\u7528\u6237\u4ee3\u7406\uff09\u5e94\u4ec5\u4f7f\u7528\u63d0\u4f9b\u4f20\u8f93\u5c42\u5b89\u5168\u6027\uff08TLS \/ SSL\uff09\u7684HTTPS\u8fde\u63a5\u81ea\u52a8\u4e0e\u5176\u8fdb\u884c\u4ea4\u4e92\uff0c\u8fd9\u4e0e\u5355\u72ec\u4f7f\u7528\u4e0d\u5b89\u5168\u7684HTTP\u4e0d\u540c\u3002<\/p>\n<p>\u670d\u52a1\u5668\u901a\u8fc7\u4e00\u4e2a\u540d\u4e3a\u201c Strict-Transport-Security \u201d\u7684HTTPS\u54cd\u5e94\u6807\u5934\u5b57\u6bb5\u5c06HSTS\u7b56\u7565\u4f20\u8fbe\u7ed9\u7528\u6237\u4ee3\u7406\u3002HSTS\u7b56\u7565\u6307\u5b9a\u7528\u6237\u4ee3\u7406\u53ea\u80fd\u4ee5\u5b89\u5168\u65b9\u5f0f\u8bbf\u95ee\u670d\u52a1\u5668\u7684\u65f6\u95f4\u6bb5\u3002\u4f7f\u7528HSTS\u7684\u7f51\u7ad9\u901a\u5e38\u4e0d\u63a5\u53d7\u660e\u6587HTTP\uff0c\u4f1a\u62d2\u7edd\u901a\u8fc7HTTP\u7684\u8fde\u63a5\uff0c\u6216\u8005\u5c06HTTP\u8fde\u63a5\u8df3\u8f6c\u5230HTTPS\u3002<\/p>\n<h2 id=\"h-hsts-1\">\u4e3a\u4ec0\u4e48HSTS\u9884\u52a0\u8f7d\u80fd\u8ba9\u7f51\u9875\u6d4f\u89c8\u901f\u5ea6\u66f4\u5feb\uff1f<\/h2>\n<p>\u901a\u4fd7\u7684\u6765\u7406\u89e3\uff1a<strong>HSTS\u4f1a\u5f3a\u5236\u6d4f\u89c8\u5668\u4ec5\u901a\u8fc7HTTPS\u8fde\u63a5<\/strong>\uff0cHSTS\u9884\u52a0\u8f7d\u5217\u8868\u662f\u7531Chrome\u53d1\u8d77\u7684\uff0c\u76ee\u524d\u4e5f\u83b7\u5f97\u4e86\u5176\u5b83\u4e3b\u6d41\u6d4f\u89c8\u5668\u7684\u652f\u6301\uff0c\u4f8b\u5982\uff1a<a href=\"https:\/\/www.google.cn\/chrome\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Chrome<\/a>\uff0c<a href=\"http:\/\/www.firefox.com.cn\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Firefox<\/a>\uff0c<a href=\"https:\/\/www.opera.com\/zh-cn\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Opera<\/a>\uff0cSafari\uff0cIE 11\u548c<a href=\"https:\/\/www.microsoft.com\/zh-cn\/edge\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Edge<\/a>\u7b49\u3002\u5c31\u662f\u6d4f\u89c8\u5668\u4f1a\u5728\u53d1\u5e03\u65b0\u7248\u672c\u7684\u65f6\u5019\uff0c\u5c06\u652f\u6301HSTS\u7684\u57df\u540d\u786c\u7f16\u7801\u8fdb\u53bb\uff0c\u5f53\u7528\u6237\u8bbf\u95ee\u8be5\u57df\u540d\uff08\u6ce8\u610f\uff1a\u5305\u542b\u6240\u6709\u5b50\u57df\u540d\uff09\u6d4f\u89c8\u5668\u4f1a\u81ea\u52a8\u8fdb\u884cHTTPS\u8fde\u63a5\uff0c\u8fd9\u6837\u51cf\u5c11\u4e86\u4e0e\u670d\u52a1\u5668\u7aef\u7684\u63e1\u624b\u65f6\u95f4\uff0c\u6240\u4ee5<strong>\u66f4\u5b89\u5168\u4e5f\u8ba9\u8bbf\u95ee\u901f\u5ea6\u66f4\u5feb<\/strong>\u3002<\/p>\n<h2 id=\"h-hsts-2\">\u5982\u4f55\u5c06\u57df\u540d\u6dfb\u52a0\u5230HSTS\u9884\u52a0\u8f7d\u5217\u8868<\/h2>\n<p>1\u3001\u9996\u5148\u57df\u540d\u5f97\u90e8\u7f72SSL\u8bc1\u4e66\uff0c\u5b9e\u73b0\u4e86\u5168\u7ad9HTTPS\u8bbf\u95ee\uff08\u4efb\u4f55\u7f51\u9875\u4e2d\u90fd\u4e0d\u80fd\u52a0\u8f7dHTTP\u8fde\u63a5\u7684\u8d44\u6e90\uff09\u3002<\/p>\n<p>2\u3001HTTP\u8fde\u63a5\u5fc5\u987b\u901a\u8fc7301\u6216302\u8df3\u8f6c\u5230HTTS\u8fde\u63a5\uff0c\u4e0b\u9762\u4ee5Nginx\u4e3a\u4f8b\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">server\r\n{\r\nlisten 80;\r\n    server_name abc.com www.abc.com;\r\n    index index.php index.html index.htm default.php default.htm default.html;\r\n    root \/wwwroot\/abc;\r\n    if ($server_port !~ 443){\r\n        rewrite ^(\/.*)$ https:\/\/$host$1 permanent;\r\n    }\r\n}<\/pre>\n<p>3\u3001\u5728\u57fa\u672c\u57df\u4e0a\uff08\u975e\u5b50\u57df\u540d\uff09\u4e3aHTTPS\u8bf7\u6c42\u63d0\u4f9bHSTS\u6807\u5934\uff1a<\/p>\n<ul>\n<li>max-age\u5fc5\u987b\u81f3\u5c1131536000\u79d2\uff081\u5e74\uff09\u3002<\/li>\n<li>includeSubDomains\u5fc5\u987b\u6307\u5b9a\u8be5\u6307\u4ee4\u3002<\/li>\n<li>preload\u5fc5\u987b\u6307\u5b9a\u8be5\u6307\u4ee4\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u4ee5Nginx\u4e3a\u4f8b\uff0c\u6dfb\u52a0\uff1a\u201cStrict-Transport-Security\u201d\u6807\u5934<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">server\r\n{\r\nlisten 443 ssl http2;\r\n    server_name abc.com www.abc.com;\r\n    index index.php index.html index.htm default.php default.htm default.html;\r\n    root \/wwwroot\/abc;\r\n\r\n#HTTP_TO_HTTPS_END\r\nssl_certificate    \/cert\/fullchain.pem;\r\nssl_certificate_key    \/cert\/privkey.pem;\r\nssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;\r\nssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;\r\nssl_prefer_server_ciphers on;\r\nssl_session_cache shared:SSL:10m;\r\nssl_session_timeout 10m;\r\nadd_header Strict-Transport-Security \"max-age=31536000;includeSubdomains; preload\";\r\n\r\n#\u2026\u2026\u6b64\u5904\u7701\u7565N\u884c\r\n\r\nerror_log  \/wwwlogs\/error.log;\r\n}<\/pre>\n<p>4\u3001\u5230<a href=\"https:\/\/hstspreload.org\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">https:\/\/hstspreload.org\/<\/a>\u63d0\u4ea4\u3002<\/p>\n<p>\u5982\u679c\u6709\u5176\u5b83\u9519\u8bef\u63d0\u793a\uff0c\u8bf7\u68c0\u67e5\u4e0a\u6587\u4e2d\u7684\u6b65\u9aa4\u662f\u5426\u6b63\u786e\u3002<\/p>\n<p>\u4e00\u822c\u6765\u8bb2\u72b6\u6001\u5904\u4e8e\u7b49\u5f85\u63d0\u4ea4\u7684\u8bdd\uff0c\u4f1a\u5728\u6d4f\u89c8\u5668\u53d1\u5e03\u4e0b\u4e00\u4e2a\u5347\u7ea7\u7248\u672c\u7684\u65f6\u5019\u63d0\u4ea4\u5230\u6d4f\u89c8\u5668\u7684HSTS\u9884\u52a0\u8f7d\u5217\u8868\uff0c\u5927\u69827-30\u5929\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ec0\u4e48\u662fHSTS\u9884\u52a0\u8f7d\u5217\u8868 HTTP Strict Transport Security\u00a0\u7ffb\u8bd1\u8fc7\u6765\u662f\uff1a\u201cHTTP &hellip; <a href=\"https:\/\/www.onwith.net\/index.php\/394.html\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">\u5982\u4f55\u5c06\u57df\u540d\u63d0\u4ea4\u5230HSTS\u9884\u52a0\u8f7d\u5217\u8868\uff0c\u4ee5\u63d0\u5347\u8bbf\u95ee\u901f\u5ea6<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[9],"tags":[82,83,81],"class_list":["post-394","post","type-post","status-publish","format-standard","hentry","category-9","tag-https","tag-ssl","tag-hsts"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":260,"url":"https:\/\/www.onwith.net\/index.php\/260.html","url_meta":{"origin":394,"position":0},"title":"\u4e0b\u8f7dWordPress\u6027\u80fd\u63d2\u4ef6\uff1aWP-Optimize Premium v3.23","author":"kuper","date":"2022\u5e744\u67083\u65e5","format":false,"excerpt":"WP-Optimize\u662f\u4e00\u6b3e\u9769\u547d\u6027\u7684\u4e00\u4f53\u5316\u63d2\u4ef6\uff0c\u5b83\u53ef\u4ee5\u6e05\u7406\u4e0e\u4f18\u5316\u6570\u636e\u5e93\uff0c\u538b\u7f29\u56fe\u7247\u5e76\u9759\u6001\u7f13\u5b58\u7f51\u7ad9\uff0c\u8fd9\u4e00\u2026","rel":"","context":"\u5728\u201cwordpress\u201d\u4e2d","block_context":{"text":"wordpress","link":"https:\/\/www.onwith.net\/index.php\/category\/wordpress"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":305,"url":"https:\/\/www.onwith.net\/index.php\/305.html","url_meta":{"origin":394,"position":1},"title":"\u4e0b\u8f7dWP Rocket v3.11.2 \u5df2\u6fc0\u6d3b\u7248\u4e0b\u8f7d","author":"kuper","date":"2022\u5e745\u67083\u65e5","format":false,"excerpt":"WP Rocket\u662fWordPress\u5f88\u6d41\u884c\u7684\u4ed8\u8d39\u7f13\u5b58\u63d2\u4ef6\u3002\u8fd8\u6709\u8bb8\u591a\u5176\u4ed6\u514d\u8d39\u7684\u6d41\u884c\u7f13\u5b58\u63d2\u4ef6\uff0c\u4f8b\u5982W3\u2026","rel":"","context":"\u5728\u201cwordpress\u201d\u4e2d","block_context":{"text":"wordpress","link":"https:\/\/www.onwith.net\/index.php\/category\/wordpress"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.onwith.net\/onwith\/2022\/05\/1651563460-featured_image-6-1.png?fit=650%2C455&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.onwith.net\/onwith\/2022\/05\/1651563460-featured_image-6-1.png?fit=650%2C455&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.onwith.net\/onwith\/2022\/05\/1651563460-featured_image-6-1.png?fit=650%2C455&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":393,"url":"https:\/\/www.onwith.net\/index.php\/393.html","url_meta":{"origin":394,"position":2},"title":"\u4e0b\u8f7dReally Simple SSL Pro v5.4.0 \u2013 \u5feb\u901f\u914d\u7f6e\u5168\u7ad9HTTPS","author":"kuper","date":"2022\u5e745\u67086\u65e5","format":false,"excerpt":"HTTPS\u5df2\u7ecf\u6210\u4e3a\u7f51\u7ad9\u7684\u6807\u914d\uff0c\u5bf9\u4e8e\u65b0\u5efa\u7684\u7ad9\u70b9\u6765\u8bf4\uff0c\u5f00\u542fHTTPS\u5e76\u4e0d\u590d\u6742\uff0c\u4f46\u5f88\u591a\u65e7\u7ad9\u70b9\u8981\u5168\u7ad9\u542f\u7528HT\u2026","rel":"","context":"\u5728\u201cwordpress\u201d\u4e2d","block_context":{"text":"wordpress","link":"https:\/\/www.onwith.net\/index.php\/category\/wordpress"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":317,"url":"https:\/\/www.onwith.net\/index.php\/317.html","url_meta":{"origin":394,"position":3},"title":"\u4e0b\u8f7dWordPress\u4f18\u5316\u63d2\u4ef6\uff1aPerfmatters v1.9.0","author":"kuper","date":"2022\u5e745\u67083\u65e5","format":false,"excerpt":"Perfmatters\u662f\u4e00\u4e2a\u975e\u5e38\u8f7b\u91cf\u7ea7\u7684WordPress\u6027\u80fd\u4f18\u5316\u63d2\u4ef6\uff0c\u4e3b\u8981\u76ee\u7684\u662f\u51cf\u5c11\u9875\u9762\u5927\u5c0f\u548cHT\u2026","rel":"","context":"\u5728\u201cwordpress\u201d\u4e2d","block_context":{"text":"wordpress","link":"https:\/\/www.onwith.net\/index.php\/category\/wordpress"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":189,"url":"https:\/\/www.onwith.net\/index.php\/189.html","url_meta":{"origin":394,"position":4},"title":"\u4e0b\u8f7dWP\u91c7\u96c6\u4e0e\u81ea\u52a8\u53d1\u5e03\u63d2\u4ef6\uff1aWordPress Automatic v3.55.6","author":"kuper","date":"2022\u5e745\u67081\u65e5","format":false,"excerpt":"WordPress Automatic Plugin\u662f\u4e00\u6b3e\u53ef\u4ee5\u91c7\u96c6\u4efb\u4f55\u7c7b\u578b\u5185\u5bb9\u4e14\u81ea\u52a8\u53d1\u5e03\u5230WordP\u2026","rel":"","context":"\u5728\u201cwordpress\u201d\u4e2d","block_context":{"text":"wordpress","link":"https:\/\/www.onwith.net\/index.php\/category\/wordpress"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":246,"url":"https:\/\/www.onwith.net\/index.php\/246.html","url_meta":{"origin":394,"position":5},"title":"\u4e0b\u8f7d\u7834\u89e3\u7248Kadence Blocks Pro v1.7.9 \u53e4\u817e\u5821\u7f16\u8f91\u5668\u589e\u5f3a\u63d2\u4ef6","author":"kuper","date":"2022\u5e744\u670822\u65e5","format":false,"excerpt":"\u8fd9\u662f\u4e00\u6b3eWordPress\u539f\u751f\u7f16\u8f91\u5668\uff08Gutenberg\uff09\u7684\u589e\u5f3a\u63d2\u4ef6\uff0c\u4f7f\u7528Kadence Block\u2026","rel":"","context":"\u5728\u201cwordpress\u201d\u4e2d","block_context":{"text":"wordpress","link":"https:\/\/www.onwith.net\/index.php\/category\/wordpress"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.onwith.net\/index.php\/wp-json\/wp\/v2\/posts\/394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.onwith.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.onwith.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.onwith.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.onwith.net\/index.php\/wp-json\/wp\/v2\/comments?post=394"}],"version-history":[{"count":0,"href":"https:\/\/www.onwith.net\/index.php\/wp-json\/wp\/v2\/posts\/394\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.onwith.net\/index.php\/wp-json\/wp\/v2\/media?parent=394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.onwith.net\/index.php\/wp-json\/wp\/v2\/categories?post=394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.onwith.net\/index.php\/wp-json\/wp\/v2\/tags?post=394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}