{"id":240,"date":"2021-06-25T20:16:27","date_gmt":"2021-06-25T12:16:27","guid":{"rendered":"https:\/\/cloudbool.com\/archive\/?p=240"},"modified":"2021-06-25T20:16:27","modified_gmt":"2021-06-25T12:16:27","slug":"nginx-draft-http3","status":"publish","type":"post","link":"https:\/\/cloudbool.com\/archive\/nginx-draft-http3.html","title":{"rendered":"Nginx\u542f\u7528\u6d4b\u8bd5\u7248HTTP3"},"content":{"rendered":"\n<p>HTTP3\u662f\u5373\u5c06\u5230\u6765\u7684\u7b2c\u4e09\u4e2aHTTP\u4e3b\u8981\u7248\u672c\uff0c\u5176\u6765\u6e90\u4e8eGoogle\u5f00\u53d1\u7684QUIC\uff0c2018\u5e74\u7531IEFT\u6279\u51c6HTTP-over-QUIC\u6210\u4e3aHTTP\/3\uff0c\u76ee\u524d\uff082021\u5e7406\u7ea6\uff09HTTP3\u8fd8\u6ca1\u6709\u6b63\u5f0f\u53d1\u5e03\uff0c\u4ecd\u662f\u8349\u6848\u72b6\u6001\uff0c\u6240\u4ee5Nginx\u5b98\u65b9\u5e76\u6ca1\u6709\u5bf9HTTP3\u63d0\u4f9b\u652f\u6301\uff0c\u4f46\u662f\u5f97\u76ca\u4e8eCloudflare\u7684\u8865\u4e01\uff0c\u6211\u4eec\u73b0\u5728\u53ef\u4ee5\u4f7f\u7528Nginx\u5c1d\u9c9c\u4e00\u4e0bHTTP3\u7684\u529f\u80fd\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<h1 class=\"wp-block-heading\">\u5199\u5728\u5f00\u59cb<\/h1>\n\n\n\n<p>\u7531\u4e8e\u76ee\u524dHTTP3\u8fd8\u662f\u8349\u6848\u72b6\u6001\u6ca1\u6709\u6b63\u5f0f\u53d1\u5e03\uff0c\u6240\u4ee5\u4e0d\u5efa\u8bae\u5c06HTTP3\u90e8\u7f72\u5230\u6b63\u5f0f\u73af\u5883\uff0c\u5efa\u8bae\u662f\u6d4b\u8bd5\u73af\u5883\u5148\u884c\u6d4b\u8bd5\u3002<\/p>\n\n\n\n<p>\u65e2\u7136\u662f\u6d4b\u8bd5\uff0c\u6211\u4eec\u5c31\u6ca1\u5fc5\u8981\u624b\u52a8\u53bb\u7f16\u8bd1\uff0cGitHub\u4e0a\u6709\u5927\u4f6c\u5f00\u6e90\u4e86\u4e00\u952e\u7f16\u8bd1\u811a\u672c\uff0c\u501f\u52a9\u8fd9\u4e2a\u811a\u672c\uff0c\u6211\u4eec\u5f88\u7b80\u5355\u5c31\u80fd\u8ba9Nginx\u6dfb\u52a0\u4e0aHTTP3\u7684\u529f\u80fd\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">nginx-autoinstall\u811a\u672c\u4e0b\u8f7d\u53ca\u4fee\u6539<\/h1>\n\n\n\n<p>nginx-autoinstall\u811a\u672c\u652f\u6301Debian8+\u4ee5\u53caUbuntu 16.04+\u4ee5\u4e0a\u7684\u7248\u672c\uff0c\u6211\u662f\u4f7f\u7528\u7684\u7eaf\u51c0\u5b89\u88c5\u7684Debian10\u7cfb\u7edf\uff0c\u4e0b\u8f7d\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install wget\nwget https:\/\/raw.githubusercontent.com\/angristan\/nginx-autoinstall\/master\/nginx-autoinstall.sh<\/code><\/pre>\n\n\n\n<p>\u56e0\u4e3a\u76ee\u524dnginx-autoinstall\u6240\u4f9d\u8d56\u7684Cloudflare\u7684HTTP3\u8865\u4e01\u53ea\u652f\u63011.19.7\u4ee5\u4e0b\u7684\u7248\u672c\uff0c\u800c\u76ee\u524dNginx\u7684\u4e3b\u7ebf\u7248\u672c\u4ee5\u53ca\u7a33\u5b9a\u7248\u672c\u7684\u7248\u672c\u53f7\u90fd\u6bd41.19.7\u66f4\u9ad8\uff0c\u6240\u4ee5\uff0c\u6211\u4eec\u5982\u679c\u60f3\u8981\u4f7f\u7528\u8fd9\u4e2a\u8865\u4e01\uff0c\u9700\u8981\u4fee\u6539\u4e0b\u8fd9\u4e2a\u811a\u672c\u6240\u4f7f\u7528\u7684\u7248\u672c\u3002<\/p>\n\n\n\n<p>\u4fee\u6539\u811a\u672c\u91cc\u9762\u7684NGINX_STABLE_VER\u53d8\u91cf\uff0c\u5c06\u5176\u8bbe\u7f6e\u6210\u6700\u540e\u4e00\u4e2a\u652f\u6301Cloudflare\u7684HTTP3\u8865\u4e01\u7248\u672c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>NGINX_STABLE_VER=1.18.0<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539\u5b8c\u4e4b\u540e\u8d4b\u4e88\u811a\u672c\u53ef\u6267\u884c\u6743\u9650\u5e76\u6267\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod +x nginx-autoinstall.sh\n.\/nginx-autoinstall.sh<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u8fc7\u7a0b\u4f1a\u8be2\u95ee\u662f\u5426\u5b89\u88c5\u4e00\u4e9b\u6a21\u5757\uff0c\u6839\u636e\u9700\u8981\u9009\u62e9\u5c31\u597d\uff0c\u5982\u679c\u53ea\u662f\u4e3a\u4e86\u6d4b\u8bd5HTTP3\uff0c\u53ea\u9700\u8981\u9009\u62e9HTTP3\u76f8\u5173\u7684\u5373\u53ef\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@cloudbool.com:~# .\/nginx-autoinstall.sh\n\nWelcome to the nginx-autoinstall script.\n\nWhat do you want to do?\n   1) Install or update Nginx\n   2) Uninstall Nginx\n   3) Update the script\n   4) Install Bad Bot Blocker\n   5) Exit\n\nSelect an option &#91;1-5]: 1\n\nThis script will install Nginx with some optional modules.\n\nDo you want to install Nginx stable or mainline?\n   1) Stable 1.18.0\n   2) Mainline 1.21.0\n\nSelect an option &#91;1-2]: 1\n\nPlease tell me which modules you want to install.\nIf you select none, Nginx will be installed with its default modules.\n\nModules to install :\n       HTTP\/3 (\u26a0\ufe0f Patch by Cloudflare for versions &lt;= 1.19.7, will install BoringSSL, Quiche, Rust and Go) &#91;y\/n]: y\n       Cloudflare's TLS Dynamic Record Resizing patch &#91;y\/n]: n\n       Cloudflare's full HPACK encoding patch &#91;y\/n]: n\n       PageSpeed 1.13.35.2 &#91;y\/n]: n\n       Brotli &#91;y\/n]: n\n       Headers More 0.33 &#91;y\/n]: n\n       GeoIP (BROKEN) &#91;y\/n]: n\n       Fancy index &#91;y\/n]: n\n       ngx_cache_purge &#91;y\/n]: n\n       nginx_substitutions_filter &#91;y\/n]: n\n       ngx_http_lua_module &#91;y\/n]: n\n       nginx WebDAV &#91;y\/n]: n\n       nginx VTS &#91;y\/n]: n\n       nginx RTMP &#91;y\/n]: n\n       nginx testcookie &#91;y\/n]: n\n       nginx ModSecurity &#91;y\/n]: n\n\nNginx is ready to be installed, press any key to continue...<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u811a\u672c\u6267\u884c\u5b8c\u6210\u4e4b\u540e\u53ef\u4ee5\u770b\u5230\u201cInstallation done.\u201d\uff0c\u8bf4\u660eNginx\u7f16\u8bd1\u6210\u529f\u5e76\u6210\u529f\u5b89\u88c5\u5230\u7cfb\u7edf\uff0c\u8fd9\u65f6\u53ef\u4ee5\u770b\u5230Nginx\u7684\u7f16\u8bd1\u9009\u9879\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@cloudbool.com:~# nginx -V\nnginx version: nginx\/1.18.0\nbuilt by gcc 8.3.0 (Debian 8.3.0-6)\nbuilt with OpenSSL 1.1.1 (compatible; BoringSSL) (running with BoringSSL)\nTLS SNI support enabled\nconfigure arguments: --prefix=\/etc\/nginx --sbin-path=\/usr\/sbin\/nginx --conf-path=\/etc\/nginx\/nginx.conf --error-log-path=\/var\/log\/nginx\/error.log --http-log-path=\/var\/log\/nginx\/access.log --pid-path=\/var\/run\/nginx.pid --lock-path=\/var\/run\/nginx.lock --http-client-body-temp-path=\/var\/cache\/nginx\/client_temp --http-proxy-temp-path=\/var\/cache\/nginx\/proxy_temp --http-fastcgi-temp-path=\/var\/cache\/nginx\/fastcgi_temp --user=nginx --group=nginx --with-cc-opt=-Wno-deprecated-declarations --with-cc-opt=-Wno-ignored-qualifiers --with-openssl=\/usr\/local\/src\/nginx\/modules\/quiche\/deps\/boringssl --with-quiche=\/usr\/local\/src\/nginx\/modules\/quiche --with-http_v2_hpack_enc --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_mp4_module --with-http_auth_request_module --with-http_slice_module --with-http_stub_status_module --with-http_realip_module --with-http_sub_module --add-module=\/usr\/local\/src\/nginx\/modules\/incubator-pagespeed-ngx-1.13.35.2-stable --add-module=\/usr\/local\/src\/nginx\/modules\/ngx_brotli --add-module=\/usr\/local\/src\/nginx\/modules\/ngx_cache_purge --add-module=\/usr\/local\/src\/nginx\/modules\/ngx_http_substitutions_filter_module --with-http_dav_module --add-module=\/usr\/local\/src\/nginx\/modules\/nginx-dav-ext-module --with-http_v3_module<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">\u914d\u7f6eNginx\u652f\u6301HTTP3<\/h1>\n\n\n\n<p>\u4fee\u6539\u6216\u8005\u65b0\u5efaNginx\u914d\u7f6e\u6587\u4ef6\uff0c\u7136\u540e\u6dfb\u52a0HTTP3\u76f8\u5173\u914d\u7f6e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n        # Enable QUIC and HTTP\/3.\n        listen 443 quic reuseport;\n\n        # Enable HTTP\/2 (optional).\n        listen 443 ssl http2;\n\n        ssl_certificate      cert.crt;\n        ssl_certificate_key  cert.key;\n\n        # Enable all TLS versions (TLSv1.3 is required for QUIC).\n        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;\n\n        # Add Alt-Svc header to negotiate HTTP\/3.\n        add_header alt-svc 'h3=\":443\"; ma=86400';\n    }<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u914d\u7f6e\u6ca1\u95ee\u9898\uff0c\u4fee\u6539\u597d\u4e4b\u540e\u91cd\u542fNginx\u5c31\u53ef\u4ee5\u6d4b\u8bd5HTTP3\u4e86\u3002<\/p>\n\n\n\n<p>\u503c\u5f97\u4e00\u63d0\u7684\u662f\uff0cCloudflare\u63d0\u4f9b\u7684\u8865\u4e01\u7684HTTP3\u76ee\u524d\u652f\u6301\u7684\u6700\u65b0\u8349\u6848\u7248\u672c\u53f7\u662f29\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>HTTP3\u662f\u5373\u5c06\u5230\u6765\u7684\u7b2c\u4e09\u4e2aHTTP\u4e3b\u8981\u7248\u672c\uff0c\u5176\u6765\u6e90\u4e8eGoogle\u5f00\u53d1\u7684QUIC\uff0c2018\u5e74\u7531IEFT\u6279\u51c6HT &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/cloudbool.com\/archive\/nginx-draft-http3.html\"> <span class=\"screen-reader-text\">Nginx\u542f\u7528\u6d4b\u8bd5\u7248HTTP3<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[8],"tags":[],"class_list":["post-240","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/comments?post=240"}],"version-history":[{"count":0,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/240\/revisions"}],"wp:attachment":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/media?parent=240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/categories?post=240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/tags?post=240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}