{"id":528,"date":"2019-06-11T15:03:51","date_gmt":"2019-06-11T07:03:51","guid":{"rendered":"https:\/\/yyshell.com\/?p=528"},"modified":"2019-06-11T15:03:51","modified_gmt":"2019-06-11T07:03:51","slug":"%e5%a6%82%e4%bd%95%e4%b8%ba%e7%bd%91%e7%ab%99%e5%90%af%e7%94%a8http2%e5%8f%8atls-1-3","status":"publish","type":"post","link":"https:\/\/yyshell.com\/?p=528","title":{"rendered":"\u5982\u4f55\u4e3a\u7f51\u7ad9\u542f\u7528http2\u53catls 1.3"},"content":{"rendered":"<p>2018\u5e748\u6708\uff0cIETF\u963b\u6b62\u5ba3\u5e03\u4e86<a href=\"https:\/\/www.ietf.org\/blog\/tls13\/\">TLS1.3<\/a>\uff0c\u76f8\u6bd4tls1.2\uff0ctls\u5927\u5927\u52a0\u5f3a\u4e86\u5b89\u5168\u7279\u6027\uff0c\u542f\u7528\u4e86\u5f88\u591a\u8fc7\u65f6\u7684\u52a0\u5bc6\u7b97\u6cd5\uff0c\u5728\u8f6f\u4ef6\u751f\u6001\u65b9\u9762\uff0c\u6d4f\u89c8\u5668\u5ba2\u6237\u7aef\uff0c\u76ee\u524d\u7684\u6700\u65b0\u7248\u7684firefox\u548cchrome\u5747\u5df2\u652f\u6301\uff0c\u4f46\u5728\u670d\u52a1\u7aef\u4e0a\uff0c\u5927\u90e8\u5206\u53d1\u884c\u7248\u7684\u8f6f\u4ef6\u4ed3\u5e93\u8fd8\u4e0d\u652f\u6301\uff08rhel8\u548c\u5373\u5c06\u53d1\u5e03\u7684debian 10\u4f1a\u539f\u751f\u652f\u6301\uff09\uff0c\u9700\u8981\u6211\u4eec\u624b\u52a8\u7f16\u8bd1\u76f8\u5173\u8f6f\u4ef6\u624d\u884c\u3002<\/p>\n<h4>\u5148\u7f16\u8bd1\u5b89\u88c5openssl<\/h4>\n<p>\u6211\u4eec\u7684Linux\u53d1\u884c\u7248\u9009\u7528CentOS 7.6\uff0c\u7cfb\u7edf\u81ea\u5e26\u7684openssl\u7248\u672c\u4e3a1.0.2k\uff0c\u5f88\u9057\u61be\u4e0d\u652f\u6301tls 1.3,\u7531\u4e8e\u5f88\u591a\u7cfb\u7edf\u81ea\u5e26\u8f6f\u4ef6\u5bf9openssl\u6709\u4f9d\u8d56\uff0c\u4e0d\u80fd\u8f7b\u6613\u5220\u9664\u6216\u6539\u53d8\uff0c\u6240\u4ee5\u6211\u4eec\u5c06\u624b\u52a8\u7f16\u8bd1openssl 1.1.1c\uff0c\u5e76\u4e14\u5b89\u88c5\u5728\u975e\u6807\u51c6\u76ee\u5f55\u3002<\/p>\n<pre class=\"lang:sh decode:true \">tar xf openssl-1.1.1c.tar.gz\r\ncd openssl-1.1.1c\/\r\nyum install gcc zlib-devel #\u5b89\u88c5\u4e0b\u4f9d\u8d56\r\n.\/config --prefix=\/opt\/openssl -Wl,-rpath=\/opt\/openssl\/lib --openssldir=\/usr\/local\/ssl shared zlib-dynamic\r\nmake &amp;&amp; make install<\/pre>\n<p>\u4e0b\u9762\u5bfc\u5165\u4e0b\u73af\u5883\u53d8\u91cf\uff0c\u65b9\u4fbf\u540e\u9762\u7f16\u8bd1nginx\u7528\u3002<\/p>\n<pre class=\"lang:sh decode:true \">export PATH=\/opt\/openssl\/bin:$PATH #\u5bfc\u5165\u73af\u5883\u53d8\u91cf\r\nopenssl version #\u67e5\u770b\u4e0b\u7248\u672c\r\nopenssl ciphers -V | column -t #\u67e5\u770b\u652f\u6301\u7684\u52a0\u5bc6\u7b97\u6cd5\u5957\u4ef6<\/pre>\n<h4>\u4e0b\u9762\u5f00\u59cb\u7f16\u8bd1\u5b89\u88c5nginx<\/h4>\n<p>\u5148\u4e0b\u8f7d\u5e76\u5b89\u88c5\u4f9d\u8d56<\/p>\n<pre class=\"lang:sh decode:true \">curl -O https:\/\/nginx.org\/download\/nginx-1.16.0.tar.gz\r\nyum install gcc-c++ pcre-devel gperftools-devel gd-devel libxml2-devel libxslt-devel perl-ExtUtils-Embed GeoIP-devel\r\ntar xf nginx-1.16.0.tar.gz\r\ncd nginx-1.16.0\/<\/pre>\n<p>configure\u4e00\u4e0b\uff1a<\/p>\n<pre class=\"lang:sh decode:true \">.\/configure --prefix=\/usr\/share\/nginx --sbin-path=\/usr\/sbin\/nginx \\\r\n--modules-path=\/usr\/lib64\/nginx\/modules --conf-path=\/etc\/nginx\/nginx.conf \\\r\n--error-log-path=\/var\/log\/nginx\/error.log --http-log-path=\/var\/log\/nginx\/access.log \\\r\n--http-client-body-temp-path=\/var\/lib\/nginx\/tmp\/client_body --http-proxy-temp-path=\/var\/lib\/nginx\/tmp\/proxy \\\r\n--http-fastcgi-temp-path=\/var\/lib\/nginx\/tmp\/fastcgi --http-uwsgi-temp-path=\/var\/lib\/nginx\/tmp\/uwsgi \\\r\n--http-scgi-temp-path=\/var\/lib\/nginx\/tmp\/scgi --pid-path=\/run\/nginx.pid --lock-path=\/run\/lock\/subsys\/nginx \\\r\n--user=nginx --group=nginx --with-file-aio --with-http_ssl_module --with-http_v2_module \\\r\n--with-openssl=..\/openssl-1.1.1c --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic \\\r\n--with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module \\\r\n--with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module \\\r\n--with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module \\\r\n--with-http_degradation_module --with-http_slice_module --with-http_stub_status_module \\\r\n--with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre \\\r\n--with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module<\/pre>\n<p>\u7f16\u8bd1\u5e76\u5b89\u88c5\uff1a<\/p>\n<pre class=\"lang:sh decode:true\">make &amp;&amp; make install<\/pre>\n<h4>\u914d\u7f6enginx<\/h4>\n<p>\u52a0\u8f7dnginx\u7684\u6a21\u5757<\/p>\n<pre class=\"lang:sh decode:true \">mkdir \/usr\/share\/nginx\/modules\r\ncd \/usr\/share\/nginx\/modules\r\ncat all.conf\r\nload_module \"\/usr\/lib64\/nginx\/modules\/ngx_http_geoip_module.so\";\r\nload_module \"\/usr\/lib64\/nginx\/modules\/ngx_http_image_filter_module.so\";\r\nload_module \"\/usr\/lib64\/nginx\/modules\/ngx_http_perl_module.so\";\r\nload_module \"\/usr\/lib64\/nginx\/modules\/ngx_http_xslt_filter_module.so\";\r\nload_module \"\/usr\/lib64\/nginx\/modules\/ngx_mail_module.so\";\r\nload_module \"\/usr\/lib64\/nginx\/modules\/ngx_stream_module.so\";<\/pre>\n<p>systemd\u914d\u7f6e\uff1a<\/p>\n<pre class=\"lang:sh decode:true\">cat \/usr\/lib\/systemd\/system\/nginx.service\r\n[Unit]\r\nDescription=The nginx HTTP and reverse proxy server\r\nAfter=network.target remote-fs.target nss-lookup.target\r\n\r\n[Service]\r\nType=forking\r\nPIDFile=\/run\/nginx.pid\r\nExecStartPre=\/usr\/bin\/rm -f \/run\/nginx.pid\r\nExecStartPre=\/usr\/sbin\/nginx -t\r\nExecStart=\/usr\/sbin\/nginx\r\nExecReload=\/bin\/kill -s HUP $MAINPID\r\nKillSignal=SIGQUIT\r\nTimeoutStopSec=5\r\nKillMode=process\r\nPrivateTmp=true\r\n\r\n[Install]\r\nWantedBy=multi-user.target<\/pre>\n<p>\u5efa\u7acb\u4e00\u4e9b\u4e34\u65f6\u76ee\u5f55\uff1a<\/p>\n<pre class=\"lang:sh decode:true\">mkdir -p \/var\/lib\/nginx\/tmp\r\ncd \/var\/lib\/\r\nchown -R nobody. nginx\/<\/pre>\n<p>nginx\u7684\u4e3b\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre class=\"lang:apache decode:true\">cat \/etc\/nginx\/nginx.conf\r\nuser nobody;\r\nworker_processes auto;\r\nerror_log \/var\/log\/nginx\/error.log;\r\npid \/run\/nginx.pid;\r\n\r\ninclude \/usr\/share\/nginx\/modules\/*.conf;\r\n\r\nevents {\r\n    worker_connections 1024;\r\n}\r\n\r\nhttp {\r\n    include mime.types;\r\n    default_type application\/octet-stream;\r\n\r\n    log_format main '$remote_addr - $remote_user [$time_local] \"$request\" '\r\n                    '$status $body_bytes_sent \"$http_referer\" '\r\n                    '\"$http_user_agent\" \"$http_x_forwarded_for\"';\r\n\r\n    access_log \/var\/log\/nginx\/access.log main;\r\n\r\n    sendfile on;\r\n    tcp_nopush on;\r\n    keepalive_timeout 65;\r\n\r\n    include \/etc\/nginx\/conf.d\/*.conf;\r\n}<\/pre>\n<p>\u914d\u7f6e\u4e0b\u865a\u62df\u4e3b\u673a\uff1a<\/p>\n<pre class=\"lang:python decode:true\">cat \/etc\/nginx\/conf.d\/yyshell.conf\r\nserver {\r\n    listen 443 ssl http2;\r\n    listen [::]:443 ssl http2;\r\n    server_name wiki.yyshell.com;\r\n    root \/var\/www\/yyshell;\r\n\r\n    ssl_certificate \"\/etc\/pki\/tls\/certs\/fullchain.pem\";\r\n    ssl_certificate_key \"\/etc\/pki\/tls\/private\/privkey.pem\";\r\n    ssl_session_cache shared:SSL:10m;\r\n    ssl_session_timeout 10m;\r\n    ssl_ciphers \"EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH\";\r\n    ssl_prefer_server_ciphers on;\r\n    ssl_protocols TLSv1.2 TLSv1.3;\r\n\r\n    location \/ {\r\n    }\r\n\r\n    error_page 404 \/404.html;\r\n    location = \/40x.html {\r\n    }\r\n\r\n    error_page 500 502 503 504 \/50x.html;\r\n    location = \/50x.html {\r\n    }\r\n}<\/pre>\n<p>\u7136\u540e\u6211\u4eec\u5728\u5bf9\u5e94\u7684\u76ee\u5f55\uff0c\u653e\u4e00\u4e2aindex.html\u6587\u4ef6\uff0c\u65b9\u4fbf\u6d4b\u8bd5\u3002\u7528firefox\u6253\u5f00\u6d4b\u8bd5\u7f51\u7ad9https:\/\/wiki.yyshell.com ,\u770b\u4e0b\u52a0\u5bc6\u8fde\u63a5\u7684\u5c5e\u6027\uff1a<\/p>\n<p><a href=\"https:\/\/yyshell.com\/wp-content\/uploads\/2019\/06\/tls13.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-531\" src=\"https:\/\/yyshell.com\/wp-content\/uploads\/2019\/06\/tls13.jpg\" alt=\"\" width=\"536\" height=\"75\" \/><\/a>\u5206\u6790\u4e0b\u5177\u4f53\u7684\u7f51\u7edc\u8bf7\u6c42\uff0c\u53ef\u4ee5\u53d1\u73b0http2\u4e5f\u542f\u7528\u4e86\u3002<\/p>\n<p><a href=\"https:\/\/yyshell.com\/wp-content\/uploads\/2019\/06\/http2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-532\" src=\"https:\/\/yyshell.com\/wp-content\/uploads\/2019\/06\/http2.jpg\" alt=\"\" width=\"392\" height=\"149\" \/><\/a><\/p>\n<p>\u67e5\u770b\u4e0b\u8fd0\u884c\u7684\u8fdb\u7a0b\uff1a<\/p>\n<pre class=\"lang:sh decode:true \">ps -ef | grep nginx\r\nroot 35494 1 0 11:21 ? 00:00:00 nginx: master process \/usr\/sbin\/nginx\r\nnobody 35495 35494 0 11:21 ? 00:00:00 nginx: worker process\r\nnobody 35496 35494 0 11:21 ? 00:00:00 nginx: worker process\r\nnobody 35497 35494 0 11:21 ? 00:00:00 nginx: worker process\r\nnobody 35498 35494 0 11:21 ? 00:00:00 nginx: worker process<\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\u6211\u4eec\u662f\u4ee5nobody\u7528\u6237\u8fd0\u884c\u7684\uff0c\u8fd9\u70b9\u548c\u914d\u7f6e\u6587\u4ef6\u4e0a\u4e00\u6837\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tJZCI6Ijk3NTEtMTU1OTM1ODQ1MjQ2MCIsImJsb2NrVHlwZSI6InBhcmFncmFwaCIsInN0eWxlcyI6eyJhbGlnbiI6ImxlZnQiLCJpbmRlbnQiOjAsInRleHQtaW5kZW50IjowLC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0seyJjaGFyIjoiYyJ9LHsiY2hhciI6ImMifSx7ImNoYXIiOiIgIn0seyJjaGFyIjoieiJ9LHsiY2hhciI6ImwifSx7ImNoYXIiOiJpIn0seyJjaGFyIjoiYiJ9LHsiY2hhciI6Ii0ifSx7ImNoYXIiOiJkIn0seyJjaGFyIjoiZSJ9LHsiY2hhciI6InYifSx7ImNoYXIiOiJlIn0seyJjaGFyIjoibCJ9XSwiaXNSaWNoVGV4dCI6dHJ1ZSwia2VlcExpbmVCcmVhayI6dHJ1ZX19XQ==--><\/p>\n<div class=\"iciba-root\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>2018\u5e748\u6708\uff0cIETF\u963b\u6b62\u5ba3\u5e03\u4e86TLS1.3\uff0c\u76f8\u6bd4tls1.2\uff0ctls\u5927\u5927\u52a0\u5f3a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,12],"tags":[],"class_list":["post-528","post","type-post","status-publish","format-standard","hentry","category-web","category-12"],"_links":{"self":[{"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/posts\/528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yyshell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=528"}],"version-history":[{"count":3,"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/posts\/528\/revisions"}],"predecessor-version":[{"id":536,"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/posts\/528\/revisions\/536"}],"wp:attachment":[{"href":"https:\/\/yyshell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yyshell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yyshell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}