{"id":1069,"date":"2024-07-06T13:48:33","date_gmt":"2024-07-06T05:48:33","guid":{"rendered":"https:\/\/blog.nonot.cn\/?p=1069"},"modified":"2024-07-08T12:40:34","modified_gmt":"2024-07-08T04:40:34","slug":"%e5%8d%87%e7%ba%a7nginx%e6%94%af%e6%8c%81tlsv1-2-tlsv1-3","status":"publish","type":"post","link":"https:\/\/blog.nonot.cn\/index.php\/2024\/07\/06\/%e5%8d%87%e7%ba%a7nginx%e6%94%af%e6%8c%81tlsv1-2-tlsv1-3\/","title":{"rendered":"\u5347\u7ea7nginx\u652f\u6301TLSv1.2 TLSv1.3"},"content":{"rendered":"<div>\n<p>\u8fd9\u4e9b\u5929\u516c\u53f8\u7cfb\u7edf\u8bf7\u4e86\u4e00\u4e9b\u641e\u6e17\u900f\u6d4b\u8bd5\u7684\uff0c\u68c0\u6d4b\u51fa\u7f51\u7ad9\u201c\u5f31\u52a0\u5bc6\u7b97\u6cd5\u201d\uff0c\u539f\u56e0\u662f\u4e4b\u524d\u7684\u73af\u5883\uff0cnginx\u7248\u672c\u592a\u4f4e\uff0c\u53ea\u652f\u6301TLSv1.0 \u548cTLSv1.1\u3002\u6240\u4ee5\u73b0\u5728\u60f3\u8981\u914d\u7f6eTLSv1.2 TLSv1.3\uff0c\u5219\u9700\u8981\u5347\u7ea7nginx\uff0c\u5176\u4e2d\u8fd8\u5305\u62ec\u4e86\u5347\u7ea7openssl\uff0c\u589e\u52a0\u4e86http_v2_module \u6a21\u5757\u6765\u652f\u6301http2\u3002\u8fd9\u5176\u4e2d\u589e\u52a0\u7684http_v2_module \u6a21\u5757\u53ef\u4ee5\u5728\u5347\u7ea7nginx\u7684\u65f6\u5019\u4e00\u8d77\u6dfb\u52a0\u8fdb\u53bb\uff0c\u56e0\u4e3a\u6211\u4e4b\u524d\u4e0d\u77e5\u9053\uff0c\u6240\u4ee5\u540e\u9762\u591a\u4e86\u4e2a\u5355\u72ec\u589e\u52a0http_v2_module \u6a21\u5757\u8fdb\u884c\u91cd\u65b0\u7f16\u8bd1\u3002<\/p>\n<h1>\u4e00\u3001\u5347\u7ea7nginx\u7248\u672c<\/h1>\n<p>\u76f4\u63a5\u53c2\u8003\u8fd9\u7bc7\u6587\u7ae0\uff1a<a href=\"https:\/\/blog.csdn.net\/weixin_45414913\/article\/details\/124801803\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/weixin_45414913\/article\/details\/124801803<\/a><\/p>\n<h1>\u4e8c\u3001\u5347\u7ea7openssl<\/h1>\n<h2>1.\u67e5\u770bopenssl\u7248\u672c<\/h2>\n<blockquote><p>openssl version<\/p><\/blockquote>\n<h2>2.\u4e0b\u8f7d\u6700\u65b0\u7a33\u5b9a\u7248\u672c\u7684OpenSSL\u6e90\u7801\u5305\u3002<\/h2>\n<blockquote><p>wget <a href=\"https:\/\/www.openssl.org\/source\/openssl-1.1.1i.tar.gz\" target=\"_blank\" rel=\"noopener\">https:\/\/www.openssl.org\/source\/openssl-1.1.1i.tar.gz<\/a><\/p><\/blockquote>\n<p>\u8fd9\u91cc\u8981\u662f\u4e0b\u8f7d\u4e0d\u4e86\u7684\u8bdd\u53ef\u4ee5\u624b\u52a8\u4e0b\u8f7d\u5b8c\u4e86\u518d\u7528ftp\u62d6\u5230\u670d\u52a1\u5668\u4e2d<\/p>\n<h2>3.\u7f16\u8bd1\u6e90\u7801\u5b89\u88c5<\/h2>\n<blockquote><p>tar -xzvf openssl-1.1.1i.tar.gz<br \/>\ncd openssl-1.1.1i<br \/>\n.\/config<br \/>\nmake &amp;&amp; make install<\/p><\/blockquote>\n<p>\u7136\u540e\u53e6\u8d77\u4e00\u4e2a\u670d\u52a1\u5668\u7a97\u53e3\uff0c\u68c0\u67e5\u4e00\u4e0bopenssl\u7248\u672c\uff0c\u4e0d\u51fa\u610f\u5916\u7684\u8bdd\u4f1a\u62a5\uff1a<code>openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory<\/code>\u9519\u8bef\uff0c<br \/>\n\u6267\u884c\u4e0b\u9762\u547d\u4ee4\uff1a<\/p>\n<blockquote><p>ln -s \/usr\/local\/lib64\/libssl.so.1.1 \/usr\/lib64\/libssl.so.1.1<br \/>\nln -s \/usr\/local\/lib64\/libcrypto.so.1.1 \/usr\/lib64\/libcrypto.so.1.1<\/p><\/blockquote>\n<p>\u5b89\u88c5\u6210\u529f<\/p>\n<h1>\u4e09\u3001\u589e\u52a0http_v2_module \u6a21\u5757<\/h1>\n<h2>1.\u67e5\u770bnginx\u539f\u6709\u7684\u6a21\u5757<\/h2>\n<blockquote><p>\/usr\/local\/nginx\/sbin\/nginx -V<\/p><\/blockquote>\n<div class=\"image-package\">\n<div class=\"image-container\">\n<div class=\"image-view\" data-width=\"1810\" data-height=\"254\"><\/div>\n<\/div>\n<div class=\"image-caption\"><a href=\"https:\/\/upload-images.jianshu.io\/upload_images\/8562370-7390fef3529f9fbb.png?imageMogr2\/auto-orient\/strip|imageView2\/2\/format\/webp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1078\" title=\"f36856a8dfe6bb02e2470a7c3bf9089b\" src=\"https:\/\/blog.nonot.cn\/wp-content\/uploads\/replace\/e33ae679f84165771b88f34a372dca79.png\" alt=\"f36856a8dfe6bb02e2470a7c3bf9089b\" width=\"1346\" height=\"171\" \/><\/a><\/div>\n<\/div>\n<p>\u540e\u9762\u7684<code>--with-http_v2_module<\/code>\u5c31\u662f\u914d\u7f6e\u597d\u7684\u65f6\u5019\u51fa\u73b0\u7684<\/p>\n<h2>2.\u6211\u4eec\u7684\u65b0\u914d\u7f6e\u4fe1\u606f\u5c31\u5e94\u8be5\u8fd9\u6837\u5199\uff0c\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u5373\u53ef\uff0c\u7b49\u914d\u7f6e\u5b8c\u3002<\/h2>\n<blockquote><p>.\/configure &#8211;prefix=\/usr\/local\/nginx &#8211;with-http_stub_status_module &#8211;with-http_ssl_module &#8211;with-http_v2_module<\/p><\/blockquote>\n<p>\u6709\u53ef\u80fd\u4f1a\u62a5\u9519\uff1a<code>SSL modules require the OpenSSL library.You can either do not enable the modules<\/code><\/p>\n<p>\u6211\u7684\u60c5\u51b5\u662f\u7cfb\u7edf\u81ea\u5e26\u4e86openssl 1.0.1\uff0c\u7136\u540e\u53c8\u81ea\u5df1\u88c5\u4e86openssl 1.1.1\uff0c\u5c31\u51fa\u8fd9\u4e2a\u95ee\u9898\u4e86\u3002\u7136\u540e\u6267\u884c\uff1a<code>yum remove openssl-devel<\/code>\u5378\u8f7d\u5c31\u597d\u4e86<\/p>\n<h2>3.\u7f16\u8bd1\u3010\u7279\u522b\u6ce8\u610f\u3011\u8fd9\u91cc\u4e0d\u8981\u8fdb\u884cmake install\uff0c\u5426\u5219\u5c31\u662f\u8986\u76d6\u4f60\u4e4b\u524d\u7684\u5b89\u88c5<\/h2>\n<blockquote><p>make<\/p><\/blockquote>\n<h2>4.\u5907\u4efd\u539f\u6709\u5df2\u5b89\u88c5\u597d\u7684nginx<\/h2>\n<blockquote><p>cp \/usr\/local\/nginx\/sbin\/nginx \/usr\/local\/nginx\/sbin\/nginx.bak<\/p><\/blockquote>\n<h2>5.\u5c06\u521a\u521a\u7f16\u8bd1\u597d\u7684nginx\u8986\u76d6\u6389\u539f\u6709\u7684nginx\uff08\u8fd9\u4e2a\u65f6\u5019\u3010\u7279\u522b\u6ce8\u610f\u3011\u8fd9\u91ccnginx\u8981\u505c\u6b62\u72b6\u6001\uff09<\/h2>\n<blockquote><p>\/usr\/local\/nginx\/sbin\/nginx -s stop<\/p><\/blockquote>\n<p>cp .\/objs\/nginx \/usr\/local\/nginx\/sbin\/<\/p>\n<h2>6.\u542f\u52a8nginx\uff0c\u4ecd\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u67e5\u770b\u662f\u5426\u5df2\u7ecf\u52a0\u5165\u6210\u529f<\/h2>\n<p>\u8fd9\u65f6\u5019\u542f\u52a8Nginx\u4e0d\u8981\u7528 <code>.\/nginx -s reload<\/code>\uff0c\u4f1a\u62a5pid\u76f8\u5173\u7684\u9519\u8bef\uff0c\u6b63\u786e\u7684\u542f\u52a8\u65b9\u5f0f\uff1a<code>\/usr\/local\/nginx\/sbin\/nginx<\/code> \u5373\u53ef\u3002<\/p>\n<h1>\u56db\u3001\u914d\u7f6eTLSv1.2 TLSv1.3<\/h1>\n<p>\u53c2\u8003\u94fe\u63a5\uff1a<a href=\"https:\/\/ssl-config.mozilla.org\/#server=nginx&amp;version=1.20.2&amp;config=intermediate&amp;openssl=1.1.1i&amp;hsts=false&amp;ocsp=false&amp;guideline=5.6\" target=\"_blank\" rel=\"noopener\">https:\/\/ssl-config.mozilla.org\/#server=nginx&amp;version=1.20.2&amp;config=intermediate&amp;openssl=1.1.1i&amp;hsts=false&amp;ocsp=false&amp;guideline=5.6<\/a><\/p>\n<div class=\"image-package\">\n<div class=\"image-container\">\n<div class=\"image-container-fill\"><\/div>\n<\/div>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1080\" title=\"c7f6e1833153aad0a24831a4b70bf898\" src=\"https:\/\/blog.nonot.cn\/wp-content\/uploads\/replace\/f4180b3f36b87d881e9b787f307c3707.png\" alt=\"c7f6e1833153aad0a24831a4b70bf898\" width=\"1030\" height=\"641\" \/>\u9a8c\u8bc1nginx\u662f\u5426\u652f\u6301TLS 1.3<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 nginx -t \u547d\u4ee4\u6765\u9a8c\u8bc1nginx\u662f\u5426\u652f\u6301TLS 1.3\uff1a<\/p>\n<p>\u5982\u679cnginx\u652f\u6301TLS 1.3\uff0c\u5c06\u4f1a\u8f93\u51fa\u4e0b\u9762\u7684\u4fe1\u606f [<a href=\"https:\/\/links.jianshu.com\/go?to=mailto%3Aroot%40iteblog.com\" target=\"_blank\" rel=\"noopener\">root@iteblog.com<\/a> ~]$ nginx -t<\/p>\n<p>nginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok<\/p>\n<p>nginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/p>\n<p>\u5982\u679cnginx\u4e0d\u652f\u6301TLS 1.3\uff0c\u5c06\u4f1a\u8f93\u51fa\u4e0b\u9762\u7684\u4fe1\u606f [<a href=\"https:\/\/links.jianshu.com\/go?to=mailto%3Aroot%40iteblog.com\" target=\"_blank\" rel=\"noopener\">root@iteblog.com<\/a> \/data\/log]$ nginx -t<\/p>\n<p>nginx: [warn] invalid value &#8220;TLSv1.3&#8221; in \/etc\/nginx\/conf.d\/default.conf:12<\/p>\n<p>nginx: configuration file \/etc\/nginx\/nginx.conf test failed<\/p>\n<h1>\u4e94\u3001\u5de5\u5177\u68c0\u6d4b<\/h1>\n<p>\u5de5\u51771\uff1a<a href=\"https:\/\/www.ssllabs.com\/ssltest\/analyze.html?d=h5-saic.matrixpr.net\" target=\"_blank\" rel=\"noopener\">https:\/\/www.ssllabs.com\/ssltest\/analyze.html?d=h5-saic.matrixpr.net<\/a><\/p>\n<div class=\"image-package\">\n<div class=\"image-container\">\n<div class=\"image-container-fill\"><\/div>\n<\/div>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1081\" title=\"431e1e20f8238cf7416e5ad98e9a2978\" src=\"https:\/\/blog.nonot.cn\/wp-content\/uploads\/replace\/321cafc05b028d546dc1027e4b16da4c.png\" alt=\"431e1e20f8238cf7416e5ad98e9a2978\" width=\"917\" height=\"630\" \/><\/p>\n<p>\u5de5\u51772\uff1a<a href=\"https:\/\/geekflare.com\/tools\/tests\/13p0ccp6a\" target=\"_blank\" rel=\"noopener\">https:\/\/geekflare.com\/tools\/tests\/13p0ccp6a<\/a><\/p>\n<div class=\"image-package\">\n<div class=\"image-container\">\n<div class=\"image-container-fill\"><\/div>\n<\/div>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1082\" title=\"ee1a1ada43bc23f7693039323649b1f1\" src=\"https:\/\/blog.nonot.cn\/wp-content\/uploads\/replace\/fc24b54ba5bcbfa61e872cb02ea3e1c6.png\" alt=\"ee1a1ada43bc23f7693039323649b1f1\" width=\"946\" height=\"621\" \/>\u53c2\u8003\uff1a<\/p>\n<p><a href=\"https:\/\/links.jianshu.com\/go?to=https%3A%2F%2Fblog.csdn.net%2Fweixin_45414913%2Farticle%2Fdetails%2F124801803\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/weixin_45414913\/article\/details\/124801803<\/a><br \/>\n<a href=\"https:\/\/links.jianshu.com\/go?to=https%3A%2F%2Fblog.csdn.net%2Finthat%2Farticle%2Fdetails%2F122829324\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/inthat\/article\/details\/122829324<\/a><br \/>\n<a href=\"https:\/\/links.jianshu.com\/go?to=https%3A%2F%2Fblog.csdn.net%2Fu010058695%2Farticle%2Fdetails%2F122948842\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/u010058695\/article\/details\/122948842<\/a><br \/>\n<a href=\"https:\/\/links.jianshu.com\/go?to=https%3A%2F%2Fblog.csdn.net%2Fqq_36902628%2Farticle%2Fdetails%2F118997046\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/qq_36902628\/article\/details\/118997046<\/a><br \/>\n<a href=\"https:\/\/links.jianshu.com\/go?to=https%3A%2F%2Fblog.csdn.net%2Fqubes%2Farticle%2Fdetails%2F120546123\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/qubes\/article\/details\/120546123<\/a><br \/>\n<a href=\"https:\/\/links.jianshu.com\/go?to=https%3A%2F%2Fblog.csdn.net%2Fqq_35624642%2Farticle%2Fdetails%2F126442054\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/qq_35624642\/article\/details\/126442054<\/a><br \/>\n<a href=\"https:\/\/links.jianshu.com\/go?to=https%3A%2F%2Fblog.csdn.net%2Fweixin_44972135%2Farticle%2Fdetails%2F106621593\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/weixin_44972135\/article\/details\/106621593<\/a><br \/>\n<a href=\"https:\/\/links.jianshu.com\/go?to=https%3A%2F%2Fwww.265.me%2Fread-25.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.265.me\/read-25.html<\/a><br \/>\n<a href=\"https:\/\/links.jianshu.com\/go?to=https%3A%2F%2Fblog.csdn.net%2Fqq_34939308%2Farticle%2Fdetails%2F120688177\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/qq_34939308\/article\/details\/120688177<\/a><br \/>\n<a href=\"https:\/\/links.jianshu.com\/go?to=http%3A%2F%2Fwww.yaotu.net%2Fbiancheng%2F785.html\" target=\"_blank\" rel=\"noopener\">http:\/\/www.yaotu.net\/biancheng\/785.html<\/a><\/p>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e9b\u5929\u516c\u53f8\u7cfb\u7edf\u8bf7\u4e86\u4e00\u4e9b\u641e\u6e17\u900f\u6d4b\u8bd5\u7684\uff0c\u68c0\u6d4b\u51fa\u7f51\u7ad9\u201c\u5f31\u52a0\u5bc6\u7b97\u6cd5\u201d&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1085,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1069","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nginx"],"_links":{"self":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/1069","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1069"}],"version-history":[{"count":2,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/1069\/revisions"}],"predecessor-version":[{"id":1087,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/1069\/revisions\/1087"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/media\/1085"}],"wp:attachment":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}