{"id":4893,"date":"2022-05-31T11:22:43","date_gmt":"2022-05-31T03:22:43","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=4893"},"modified":"2022-05-31T11:22:49","modified_gmt":"2022-05-31T03:22:49","slug":"nginx%e5%ae%89%e8%a3%85ssl%e8%af%81%e4%b9%a6-nginx%e9%85%8d%e7%bd%aehttps%e8%af%81%e4%b9%a6","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/4893\/","title":{"rendered":"Nginx\u5b89\u88c5SSL\u8bc1\u4e66 Nginx\u914d\u7f6ehttps\u8bc1\u4e66"},"content":{"rendered":"\n<figure id=\"pid16902\" class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td><span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/nginx%e5%ae%89%e8%a3%85ssl\/\" title=\"Nginx\u5b89\u88c5SSL\" target=\"_blank\">Nginx\u5b89\u88c5SSL<\/a><\/span>\u8bc1\u4e66 <span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/nginx%e9%85%8d%e7%bd%aehttps\/\" title=\"Nginx\u914d\u7f6ehttps\" target=\"_blank\">Nginx\u914d\u7f6ehttps<\/a><\/span>\u8bc1\u4e66<br>\u9996\u5148\u62ff\u5230<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/nginx\/\" title=\"Nginx\" target=\"_blank\">Nginx<\/a><\/span>\u670d\u52a1\u5668\u8bc1\u4e66<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>yourdomain.com.crt     (\u670d\u52a1\u5668\u8bc1\u4e66)\r\nyourdomain.com.key   (\u79c1\u94a5\u6587\u4ef6\uff09\u5982\u679c\u4e3a\u7a7a\u8bf7\u5c06\u751f\u6210CSR\u65f6\u4fdd\u5b58\u7684\u79c1\u94a5\u5185\u5bb9\u7c98\u8d34\u5728\u6587\u4ef6\u4e2d<\/code><\/pre>\n\n\n\n<p><strong>\u73af\u5883\u68c0\u6d4b<\/strong>\uff0c\u68c0\u6d4b\u547d\u4ee4\u5982\u4e0b\uff08\u6d4b\u8bd5nginx\u662f\u5426\u652f\u6301SSL\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx -V<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u6709\u663e\u793a \u2013with-http_<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/ssl\/\" title=\"ssl\" target=\"_blank\">ssl<\/a><\/span>_module \u8868\u793a\u5df2\u7f16\u8bd1openssl\uff0c\u652f\u6301\u5b89\u88c5ssl\uff1b<\/p>\n\n\n\n<p>\u5982\u679c\u6ca1\u6709\u5b89\u88c5\u8bf7\u4e0b\u8f7dnginx\u6e90\u7801\u91cd\u65b0\u7f16\u8bd1\uff1b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/configure --with-http_stub_status_module --with-http_ssl_module\r\nmake &amp;&amp; make install<\/code><\/pre>\n\n\n\n<p><strong>\u914d\u7f6eNginx<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\r\n listen 80;\r\n listen 443 ssl;\r\n server_name www.yourdomain.com;\r\n\r\n ssl_protocols TLSv1.2 TLSv1.1 TLSv1;\r\n ssl_certificate \/etc\/ssl\/yourdomain.com.crt;\r\n ssl_certificate_key \/etc\/ssl\/yourdomain.com.key;\r\n ssl_prefer_server_ciphers on;\r\n \r\n #\u81ea\u52a8\u8df3\u8f6c\u5230HTTPS (\u53ef\u9009)\r\n if ($server_port = 80) {\r\n rewrite ^(.*)$ https:\/\/$host$1 permanent;\r\n }\r\n \r\n location \/ {\r\n root \/home\/yourdomain\/;\r\n index index.php;\r\n }\r\n}<\/code><\/pre>\n\n\n\n<p>\u8bf7\u5c06\u57df\u540d\u4fee\u6539\u4e3a\u60a8\u81ea\u5df1\u7684<\/p>\n\n\n\n<p>\u4ee5\u4e0a\u914d\u7f6e\u4ec5\u4f9b\u53c2\u8003\uff0c\u5176\u4ed6\u53c2\u6570\u8bf7\u6839\u636e\u751f\u4ea7\u73af\u5883\u9700\u8981\u6dfb\u52a0\u3002\u5b89\u88c5\u540e\u91cd\u542fnginx\u4f7f\u5176\u751f\u6548<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>centos6\r\nservice nginx restart\r\ncentos7\r\nsystemctl restart nginx<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u914d\u7f6e\u4ec5\u4f9b\u53c2\u8003\uff0c\u5176\u4ed6\u53c2\u6570\u8bf7\u6839\u636e\u751f\u4ea7\u73af\u5883\u9700\u8981\u6dfb\u52a0\u3002\u5b89\u88c5\u540e\u91cd\u542fnginx\u4f7f\u5176\u751f\u6548\uff0cNginx\u5b89\u88c5SSL\u8bc1\u4e66 Nginx\u914d\u7f6ehttps\u8bc1\u4e66<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1481],"tags":[1498,1499,1500,212,1484],"special":[],"attr":[],"class_list":{"0":"post-4893","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-ssl","7":"tag-nginx","8":"tag-nginxssl","9":"tag-nginxhttps","10":"tag-ssl","12":"entry"},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/4893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/comments?post=4893"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/4893\/revisions"}],"predecessor-version":[{"id":4894,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/4893\/revisions\/4894"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=4893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=4893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=4893"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=4893"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=4893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}