{"id":1105,"date":"2019-02-12T19:53:26","date_gmt":"2019-02-12T11:53:26","guid":{"rendered":"http:\/\/www.ily22.com\/?p=1105"},"modified":"2019-02-12T19:53:26","modified_gmt":"2019-02-12T11:53:26","slug":"%e4%b8%80%e9%94%aelnmp%e9%85%8d%e7%bd%aessl%e8%af%81%e4%b9%a6%ef%bc%8c%e5%85%a8%e7%ab%99httpss%e8%ae%bf%e9%97%ae","status":"publish","type":"post","link":"https:\/\/www.geek2.xyz\/?p=1105","title":{"rendered":"\u4e00\u952eLNMP\u914d\u7f6eSSL\u8bc1\u4e66\uff0c\u5168\u7ad9httpss\u8bbf\u95ee"},"content":{"rendered":"<p>\u76f8\u4fe1\u5f88\u591a\u4eba\u642d\u5efa\u7f51\u7ad9\u90fd\u7528\u4e86\u4e00\u952eLNMP\uff0c\u65b9\u4fbf\u53c8\u5feb\u6377\uff0c\u4e0d\u8fc7\u7f51\u7ad9\u642d\u5efa\u540e\u8fd8\u6709\u4e00\u4e2a\u91cd\u8981\u7684\u6b65\u9aa4\u5c31\u662f\u52a0\u5165SSL\u8bc1\u4e66\uff0c\u8ba9httpss\u65b9\u5f0f\u8bbf\u95ee\u7f51\u7ad9\uff0c\u90a3\u600e\u4e48\u6765\u5f04\u5462\uff1f\u9996\u5148\u627e\u5230nginx\u7684\u5b89\u88c5\u76ee\u5f55\u627e\u5230\u76ee\u5f55\uff0c\u6211\u7684\u76ee\u5f55: \/usr\/local\/nginx\/\uff0c\u5982\u4e0b\u56fe\uff0c\u4f7f\u7528Xftp\u5de5\u5177\u767b\u9646\u7684\uff0c\u8fd9\u4e2a\u5de5\u5177\u65b9\u4fbf\u3002<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1106\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image.png\" \/><\/p>\n<p>\u5173\u4e8eSSL\u8bc1\u4e66\uff0c\u5176\u5b9e\u5728\u5404\u5927\u7f51\u7ad9\u90fd\u53ef\u4ee5\u514d\u8d39\u7533\u8bf7\uff0c\u5927\u90e8\u5206\u662f\u514d\u8d39\u4e00\u5e74\uff0c\u6211\u662f\u5728\u963f\u91cc\u7533\u8bf7\u7684\uff0c\u7533\u8bf7\u540e\u628a\u5bf9\u5e94\u7684\u8bc1\u4e66\u4e0b\u8f7d\u8fc7\u6765\u5c31\u884c\u4e86\uff08nginx\u3001apache\u3001IIS\u3001tomcat\u73af\u5883\u90fd\u652f\u6301\uff09\uff0c\u6211\u9009\u62e9nginx\u8bc1\u4e66\u4e0b\u8f7d\u3002\u7136\u540e\u5728nginx\u76ee\u5f55\u4e0b\u521b\u5efa\u6587\u4ef6\u5939\uff0c\u6bd4\u5982\u6211\u521b\u5efa\u4e86cert\u7136\u540e\u628a\u8bc1\u4e66\u4e0a\u4f20\u5230\u6b64\u6587\u4ef6\u5939\u5185\u3002<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1107\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image-1.png\" \/><\/p>\n<p>\u8bc1\u4e66\u4e0a\u4f20\u540e\u5982\u4e0b\u56fe<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1108\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image-2.png\" \/><\/p>\n<p>\u63a5\u4e0b\u6765\u5c31\u662f\u7f16\u8f91nginx\u914d\u7f6e\u6587\u4ef6\uff0c\u5230\u76ee\u5f55\/usr\/local\/nginx\/conf\u4e0b\u627e\u5230nginx.conf\u7528\u8bb0\u4e8b\u672c\u6253\u5f00\u7f16\u8f91\u3002\u5176\u5b9e\u4f60\u4e5f\u53ef\u4ee5\u76f4\u63a5\u5728Xshell\u6216\u8005PuTTY\u76f4\u63a5vi\u7f16\u8f91\u4fee\u6539\u3002<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1109\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image-3.png\" \/><\/p>\n<p>\u6253\u5f00\u540e\u627e\u5230server\u5904<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1110\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image-4.png\" \/><\/p>\n<p>\u6211\u4eec\u9700\u8981\u7f16\u8f91\u7684\u5730\u65b9\u4e3b\u8981\u662f\u52a0\u5165\u8fd9\u51e0\u70b9\uff1a<\/p>\n<p>listen 443 ssl;<\/p>\n<p>ssl on;<\/p>\n<p>ssl_certificate \/\u4f60\u4e0a\u4f20\u7684\u8bc1\u4e66\u76ee\u5f55\u548c\u8bc1\u4e66\u540d\u79f0.crt;<\/p>\n<p>ssl_certificate_key \/\u4f60\u4e0a\u4f20\u7684\u8bc1\u4e66\u76ee\u5f55\u548c\u8bc1\u4e66\u540d\u79f0.key;<\/p>\n<p>\u5177\u4f53\u5982\u4e0b\u56fe<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1111\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image-5.png\" \/><\/p>\n<p>\u4fee\u6539\u5b8c\u4fdd\u5b58\uff0c\u7136\u540e\u91cd\u542fnginx\uff0c\u56e0\u4e3a\u662flinux\u7cfb\u7edf\u53ef\u4ee5\u7528Xshell\u6216\u8005PuTTY\u7b49\u8fde\u63a5\u540e\u8f93\u5165\u6307\u4ee4\/etc\/init.d\/nginx restart\u91cd\u542fnginx\u3002\uff08\u6bcf\u6b21\u4fee\u6539\u914d\u7f6e\u4fdd\u5b58\u540e\u4e00\u822c\u9700\u8981\u91cd\u542f\u624d\u80fd\u751f\u6548\uff09<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1112\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image-6.png\" \/><\/p>\n<p>\u7136\u540e\u8f93\u5165\u7f51\u5740\uff0chttpss\u6b63\u5e38\u8bbf\u95ee<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1113\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image-7.png\" \/><\/p>\n<p>\u4e0d\u8fc7\u8981https\u8bbf\u95ee\u7684\u8bdd\u4f1a400\u62a5\u9519<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1114\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image-8.png\" \/><\/p>\n<p><img decoding=\"async\" class=\"wp-image-1115\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image-9.png\" \/><\/p>\n<p>400 Bad Request<\/p>\n<p>The plain HTTP request was sent to HTTPS port<\/p>\n<p>\u89e3\u51b3\u529e\u6cd5\u5c06\u4e0a\u9762\u914d\u7f6e\u6587\u4e2d\u7684\u201c ssl on ; \u201d \u6ce8\u91ca\u6389\u6216\u8005\u4fee\u6539\u6210 \u201c ssl off ;\u201d\uff0c\u8fd9\u6837\uff0cnginx\u5c31\u53ef\u4ee5\u540c\u65f6\u5904\u7406HTTP\u8bf7\u6c42\u548cHTTPS\u8bf7\u6c42\u4e86\u3002<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1116\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image-10.png\" \/><\/p>\n<p>\u7136\u540e\u7f51\u7ad9\u53ef\u4ee5HTTP\u548cHTTPS\u540c\u65f6\u8bbf\u95ee\u3002\u4e0d\u8fc7\uff0c\u6211\u4eec\u4e0d\u60f3\u8fd8\u6709https\u80fd\u8bbf\u95ee\uff0c\u8981\u5168\u7ad9httpss\u8bbf\u95ee\u5462\uff1f<\/p>\n<p>\u5176\u5b9e\u8fd9\u4e2a\u4e5f\u4e0d\u96be\uff0c\u6211\u4eec\u53ea\u8981\u4fee\u6539\u4e24\u6761\u5c31\u89e3\u51b3\u4e86\uff0c\u9996\u5148\u5c31\u662f\u5728server_name _;\u4e2d\u52a0\u5165\u57df\u540d\u5e26www\u548c\u4e0d\u5e26\u7684\uff0c\u6700\u540e\u518d\u52a0\u4e00\u53e5\u5b9a\u5411\u8bed\u53e5\uff1a<\/p>\n<p>if ($scheme = https ) {return 301 httpss:\/\/$host$request_uri;}<\/p>\n<p>\u4fee\u6539\u7684\u8303\u56f4\u5165\u4e0b\u56fe\u4e24\u4e2a\u4e2a\u6846\u4e2d\uff0c\u5176\u4ed6\u4e0d\u7528\u4fee\u6539<\/p>\n<p><img decoding=\"async\" class=\"wp-image-1117\" src=\"http:\/\/www.geek2.xyz\/wp-content\/uploads\/2019\/02\/word-image-11.png\" \/><\/p>\n<p>\u8fd9\u6837\u7f51\u7ad9\u5c31\u5f00\u542f\u4e86\u5168\u7ad9httpss\u8bbf\u95ee\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76f8\u4fe1\u5f88\u591a\u4eba\u642d\u5efa\u7f51\u7ad9\u90fd\u7528\u4e86\u4e00\u952eLNMP\uff0c\u65b9\u4fbf\u53c8\u5feb\u6377\uff0c\u4e0d\u8fc7\u7f51\u7ad9\u642d\u5efa\u540e\u8fd8\u6709\u4e00\u4e2a\u91cd\u8981\u7684\u6b65\u9aa4\u5c31\u662f\u52a0\u5165SSL\u8bc1\u4e66\uff0c\u8ba9htt [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1117,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[16,20,21],"class_list":["post-1105","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jsfx","tag-httpss","tag-linux","tag-lnmp"],"_links":{"self":[{"href":"https:\/\/www.geek2.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.geek2.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.geek2.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.geek2.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.geek2.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1105"}],"version-history":[{"count":0,"href":"https:\/\/www.geek2.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1105\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.geek2.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.geek2.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.geek2.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}