{"id":814,"date":"2023-09-04T13:57:25","date_gmt":"2023-09-04T05:57:25","guid":{"rendered":"http:\/\/gjweb.top\/?p=814"},"modified":"2023-09-04T13:57:26","modified_gmt":"2023-09-04T05:57:26","slug":"nginx-%e9%85%8d%e7%bd%ae-https-%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=814","title":{"rendered":"nginx \u914d\u7f6e https \u73af\u5883"},"content":{"rendered":"\n<p>\u4ee5\u817e\u8baf ssl \u7533\u8bf7\u4e3a\u4f8b,\u4ece 0 \u5f00\u59cb\u914d\u7f6e https ;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u817e\u8baf\u4e91\u7533\u8bf7ssl\u8bc1\u4e66\">\u817e\u8baf\u4e91\u7533\u8bf7ssl\u8bc1\u4e66<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/raw.githubusercontent.com\/gongjianOnline\/ImgHosting\/main\/img\/1693790916378.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/raw.githubusercontent.com\/gongjianOnline\/ImgHosting\/main\/img\/1693790916378.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\"\/><\/div><\/figure>\n\n\n\n<p>\u7533\u8bf7\u514d\u8d39\u7684ssl\u8bc1\u4e66,\u8d70\u5b8c\u5411\u5bfc,\u83b7\u5f97\u8bc1\u4e66\u4fe1\u606f,\u4e0b\u8f7d nginx \u8bc1\u4e66<\/p>\n\n\n\n<p>\u8bc1\u4e66\u6587\u4ef6\u5305\u62ec<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u57df\u540d.csr<\/li><li>\u57df\u540d.key<\/li><li>\u57df\u540d_bundle.crt<\/li><li>\u57df\u540d_bundle.pem<\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"nginx\u914d\u7f6e\">nginx\u914d\u7f6e<\/h2>\n\n\n\n<p>\u5728\u5b89\u88c5 nginx \u9ed8\u8ba4\u662f\u6ca1\u6709 https \u6a21\u5757\u7684,\u9700\u8981\u91cd\u65b0\u5b89\u88c5<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u67e5\u770b\u670d\u52a1\u5668nginx\u7248\u672c\">\u67e5\u770b\u670d\u52a1\u5668nginx\u7248\u672c<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/sbin\/nginx -V<\/code><\/pre>\n\n\n\n<p>\u4ee5 1.14.0 \u4e3a\u4f8b\u5b89\u88c5\u6e90\u7801\u5305<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/nginx.org\/download\/nginx-1.14.0.tar.gz <\/code><\/pre>\n\n\n\n<p>\u89e3\u538b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>unzip nginx-1.14.0.tar.gz <\/code><\/pre>\n\n\n\n<p>\u8fdb\u5165 nginx-1.14.0 , \u914d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/configure --prefix=\/usr\/local\/nginx --with-http_stub_status_module --with-http_ssl_module<\/code><\/pre>\n\n\n\n<p>\u6267\u884c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make<\/code><\/pre>\n\n\n\n<p>\u5907\u4efd\u539f\u6709\u7684\u5b89\u88c5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cp \/usr\/local\/nginx\/sbin\/nginx \/usr\/local\/nginx\/sbin\/nginx.bak<\/code><\/pre>\n\n\n\n<p>\u7f16\u8bd1\u597d\u7684nginx\u8986\u76d6\u6389\u539f\u6709\u7684nginx<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cp .\/objs\/nginx \/usr\/local\/nginx\/sbin\/<\/code><\/pre>\n\n\n\n<p>\u5c06 \u4e0b\u8f7d\u7684\u6587\u4ef6\u5939 \u57df\u540d_bundle.crt \u548c \u57df\u540d.key \u4e24\u4e2a\u6587\u4ef6\u653e\u5728 nginx \u6839\u76ee\u5f55\uff0c\u5728 nginx.config \u4e2d\u6dfb\u52a0\u914d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {<br> &nbsp; &nbsp; &nbsp; &nbsp;#SSL \u9ed8\u8ba4\u8bbf\u95ee\u7aef\u53e3\u53f7\u4e3a 443<br> &nbsp; &nbsp; &nbsp; &nbsp;listen 443 ssl; <br> &nbsp; &nbsp; &nbsp; &nbsp;#\u8bf7\u586b\u5199\u7ed1\u5b9a\u8bc1\u4e66\u7684\u57df\u540d<br> &nbsp; &nbsp; &nbsp; &nbsp;server_name \u57df\u540d; <br> &nbsp; &nbsp; &nbsp; &nbsp;#\u8bf7\u586b\u5199\u8bc1\u4e66\u6587\u4ef6\u7684\u76f8\u5bf9\u8def\u5f84\u6216\u7edd\u5bf9\u8def\u5f84<br> &nbsp; &nbsp; &nbsp; &nbsp;ssl_certificate \u57df\u540d_bundle.crt; <br> &nbsp; &nbsp; &nbsp; &nbsp;#\u8bf7\u586b\u5199\u79c1\u94a5\u6587\u4ef6\u7684\u76f8\u5bf9\u8def\u5f84\u6216\u7edd\u5bf9\u8def\u5f84<br> &nbsp; &nbsp; &nbsp; &nbsp;ssl_certificate_key \u57df\u540d.key; <br> &nbsp; &nbsp; &nbsp; &nbsp;ssl_session_timeout 5m;<br> &nbsp; &nbsp; &nbsp; &nbsp;#\u8bf7\u6309\u7167\u4ee5\u4e0b\u534f\u8bae\u914d\u7f6e<br> &nbsp; &nbsp; &nbsp; &nbsp;ssl_protocols TLSv1.2 TLSv1.3; <br> &nbsp; &nbsp; &nbsp; &nbsp;#\u8bf7\u6309\u7167\u4ee5\u4e0b\u5957\u4ef6\u914d\u7f6e\uff0c\u914d\u7f6e\u52a0\u5bc6\u5957\u4ef6\uff0c\u5199\u6cd5\u9075\u5faa openssl \u6807\u51c6\u3002<br> &nbsp; &nbsp; &nbsp; &nbsp;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; <br> &nbsp; &nbsp; &nbsp; &nbsp;ssl_prefer_server_ciphers on;<br> &nbsp; &nbsp; &nbsp; &nbsp;location \/ {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#\u7f51\u7ad9\u4e3b\u9875\u8def\u5f84\u3002\u6b64\u8def\u5f84\u4ec5\u4f9b\u53c2\u8003\uff0c\u5177\u4f53\u8bf7\u60a8\u6309\u7167\u5b9e\u9645\u76ee\u5f55\u64cd\u4f5c\u3002<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#\u4f8b\u5982\uff0c\u60a8\u7684\u7f51\u7ad9\u4e3b\u9875\u5728 Nginx \u670d\u52a1\u5668\u7684 \/etc\/www \u76ee\u5f55\u4e0b\uff0c\u5219\u8bf7\u4fee\u6539 root \u540e\u9762\u7684 html \u4e3a \/etc\/www\u3002<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;root html; <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;index &nbsp;index.html index.htm;<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<\/code><\/pre>\n\n\n\n<p>\u91cd\u542fnginx<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/sbin\/nginx -s reload<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u914d\u7f6e\u597d\u540e\u65e0\u6cd5\u901a\u8fc7-https-\u8bbf\u95ee\">\u914d\u7f6e\u597d\u540e\u65e0\u6cd5\u901a\u8fc7 https \u8bbf\u95ee<\/h2>\n\n\n\n<p>\u5b89\u88c5 nmap<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install nmap<\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528 nmap \u626b\u63cf80\u548c443\u7aef\u53e3<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> nmap -Pn IP -p 80,443<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u76d1\u542c\u5230 443 \u7aef\u53e3\u65f6\u5173\u95ed\u72b6\u6001\uff0c\u5982\u4e0b\u56fe\u6240\u793a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/raw.githubusercontent.com\/gongjianOnline\/ImgHosting\/main\/img\/1693805725587.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/raw.githubusercontent.com\/gongjianOnline\/ImgHosting\/main\/img\/1693805725587.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\"\/><\/div><\/figure>\n\n\n\n<p>\u89e3\u51b3\u65b9\u6848\u4e00\uff1a<\/p>\n\n\n\n<p>\u5f3a\u5236\u505c\u6b62nginx \u624b\u52a8\u542f\u52a8<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/sbin\/nginx -s stop<br>.\/sbin\/nginx <\/code><\/pre>\n\n\n\n<p>\u91cd\u65b0\u626b\u63cf\uff0c\u67e5\u770b433\u662f\u5426\u5f00\u542f<\/p>\n\n\n\n<p>\u89e3\u51b3\u65b9\u6848\u4e8c\uff1a<\/p>\n\n\n\n<p>\u5982\u679c\u65b9\u6848\u4e00\u65e0\u6548\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u662f\u5426\u5f00\u542f\u72b6\u6001\uff0c\u53ef\u4ee5\u5173\u95ed\u9632\u706b\u5899<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl stop firewalld  \/*\u505c\u6b62\u670d\u52a1*\/<br>sudo systemctl disable firewalld \/*\u7981\u7528\u9632\u706b\u5899\u670d\u52a1\uff0c\u9632\u6b62\u5f00\u673a\u81ea\u542f*\/<br>sudo systemctl status firewalld \/*\u68c0\u67e5\u9632\u706b\u5899\u670d\u52a1\u72b6\u6001*\/<\/code><\/pre>\n\n\n\n<p>\u89e3\u51b3\u65b9\u6848\u4e09\uff1a<\/p>\n\n\n\n<p>\u5982\u679c\u65b9\u6848\u4e00\u548c\u4e8c\u90fd\u65e0\u6548\u53ef\u4ee5\u5c1d\u8bd5\uff0c\u5c06443\u7aef\u53e3\u6dfb\u52a0\u5230\u9632\u706b\u5899\u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\u6dfb\u52a0\u4e00\u4e2a\u6c38\u4e45\u7684\u89c4\u5219\uff0c\u5141\u8bb8 TCP \u8fde\u63a5\u901a\u8fc7 443 \u7aef\u53e3\u3002*\/<br>sudo firewall-cmd --zone=public --add-port=443\/tcp --permanent<br>\/*\u91cd\u542f\u9632\u706b\u5899*\/<br>sudo firewall-cmd --reload<br>\/*\u67e5\u770b\u7aef\u53e3\u8fd0\u884c\u72b6\u6001*\/<br>sudo firewall-cmd --zone=public --list-ports<\/code><\/pre>\n\n\n\n<p>\u89e3\u51b3\u65b9\u6848\u56db<\/p>\n\n\n\n<p>\u67e5\u770b\u670d\u52a1\u5668\u4e91\u5382\u5546\u7684\u5b89\u5168\u7ec4\u65f6\u5019\u5141\u8bb8\u4e86 443 \u7aef\u53e3\u8bbf\u95ee;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u817e\u8baf ssl \u7533\u8bf7\u4e3a\u4f8b,\u4ece 0 \u5f00\u59cb\u914d\u7f6e https ; \u817e\u8baf\u4e91\u7533\u8bf7ssl\u8bc1\u4e66 \u7533\u8bf7\u514d\u8d39\u7684ssl\u8bc1\u4e66,\u8d70\u5b8c\u5411 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67],"tags":[],"class_list":["post-814","post","type-post","status-publish","format-standard","hentry","category-nginx"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=814"}],"version-history":[{"count":1,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/814\/revisions"}],"predecessor-version":[{"id":815,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/814\/revisions\/815"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}