{"id":1209,"date":"2021-04-26T16:10:57","date_gmt":"2021-04-26T08:10:57","guid":{"rendered":"https:\/\/cloudbool.com\/archive\/?p=1209"},"modified":"2021-04-26T16:10:57","modified_gmt":"2021-04-26T08:10:57","slug":"nginx-autoinstall-http3","status":"publish","type":"post","link":"https:\/\/cloudbool.com\/archive\/nginx-autoinstall-http3.html","title":{"rendered":"Nginx\b\u542f\u7528HTTP3"},"content":{"rendered":"\n<p>HTTP3\u662fHTTP\u534f\u8bae\u7684\u7b2c\u4e09\u4e2a\u4e3b\u8981\u7248\u672c\uff0c\u662f\u7531Google\u5f00\u53d1\u7684QUIC\u534f\u8bae\u5f00\u53d1\u800c\u6765\uff0c\u8ddf\u76ee\u524d\u7684HTTP2\u76f8\u6bd4\uff0cHTTP3\u4e0d\u662f\u57fa\u4e8eTCP\u800c\u662f\u57fa\u4e8eUDP\u534f\u8bae\uff0cHTTP3\u76ee\u524d\uff082021\u5e7404\u6708\uff09\u8fd8\u662f\u8349\u6848\u72b6\u6001\uff0c\u6682\u672a\u63a8\u51fa\u6b63\u5f0f\u7248\u672c\u3002<\/p>\n\n\n<!--more-->\n\n\n<h1 class=\"wp-block-heading\">\u5f00\u59cb\u4e4b\u524d<\/h1>\n\n\n<p>\u7531\u4e8e\u76ee\u524dHTTP3\u8fd8\u6ca1\u6709\u53d1\u5e03\u6b63\u5f0f\u7248\uff0c\u4e0d\u5efa\u8bae\u5728\u751f\u4ea7\u73af\u5883\u4f7f\u7528\uff0c\u5982\u679c\u60f3\u5c1d\u9c9c\u5efa\u8bae\u5728\u6d4b\u8bd5\u670d\u52a1\u5668\u4e0a\u8fdb\u884c\u3002<\/p>\n\n\n<p>\u76ee\u524dNginx\u5b98\u65b9\u6682\u672a\u652f\u6301HTTP3\uff0c\u60f3\u4f7f\u7528HTTP3\u7684\u8bdd\u9700\u8981\u81ea\u884c\u7f16\u8bd1\uff0c\u6240\u4ee5\u5982\u679c\u4f7f\u7528\u7684\u662fNginx\u73b0\u5728\u53c8\u60f3\u8981\u5c1d\u9c9cHTTP3\uff0c\u9700\u8981\u4f7f\u7528Cloudflare\u5f00\u53d1\u7684\u8865\u4e01\u91cd\u65b0\u7f16\u8bd1Nginx\u3002<\/p>\n\n\n<h1 class=\"wp-block-heading\">\u7f16\u8bd1\u73af\u5883<\/h1>\n\n\n<p>\u6211\u4f7f\u7528\u7684\u662f\u5168\u65b0\u7eaf\u51c0\u5b89\u88c5\u7684Debian10\u7cfb\u7edf\uff0c\u914d\u7f6e\u4e3a2G\u5185\u5b581\u6838CPU\u4ee5\u53ca55GSSD\u7684<a rel=\"noreferrer noopener\" href=\"https:\/\/u.cloudbool.com\/vultr\" target=\"_blank\">Vultr<\/a>\u670d\u52a1\u5668\uff0c\u6d89\u53ca\u5230\u6a21\u5757\u7f16\u8bd1\uff0c\u5efa\u8bae\u4e0d\u8981\u4f7f\u7528\u914d\u7f6e\u592a\u5dee\u7684\u670d\u52a1\u5668\uff0c2G\u5185\u5b58\u5e94\u8be5\u662f\u5fc5\u987b\u7684\u3002<\/p>\n\n\n<p>\u7f16\u8bd1\u8fc7\u7a0b\u9700\u8981\u4eceGitHub\u4e0b\u8f7d\u4e00\u4e9b\u6a21\u5757\uff0c\u5bf9\u7f51\u7edc\u53ef\u80fd\u6709\u4e00\u70b9\u8981\u6c42\u3002<\/p>\n\n\n<p>\u6574\u4e2a\u7f16\u8bd1\u8fc7\u7a0b\u4f7f\u7528\u7684\u662froot\u8d26\u6237\uff0c\u5982\u679c\u5f53\u524d\u4e0d\u662f\u4ee5root\u7528\u6237\u767b\u5f55\uff0c\u7f16\u8bd1\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u4f7f\u7528sudo\u547d\u4ee4\u3002<\/p>\n\n\n<h1 class=\"wp-block-heading\">\u7f16\u8bd1\u8fc7\u7a0b<\/h1>\n\n\n<p>\u56e0\u4e3a\u7f16\u8bd1\u8fc7\u7a0b\u6d89\u53ca\u5230\u6bd4\u8f83\u591a\u7684\u6b65\u9aa4\uff0c\u53ea\u662f\u4e3a\u4e86\u5c1d\u9c9cHTTP3\u800c\u5df2\uff0c\u6240\u4ee5\u6211\u627e\u4e86\u4e00\u4e2a\u5f00\u6e90\u7684\u811a\u672c\u6765\u51cf\u5c11\u5de5\u4f5c\u91cf\uff0c\u5927\u591a\u6570\u7f16\u8bd1\u6b65\u9aa4\u5df2\u7ecf\u5b8c\u6210\uff0c\u80fd\u514d\u53bb\u6211\u4eec\u5f88\u591a\u8c03\u8bd5\u7684\u8fc7\u7a0b\u3002<\/p>\n\n\n<p>\u7f16\u8bd1\u76f8\u5173\u547d\u4ee4\uff1a<\/p>\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/raw.githubusercontent.com\/angristan\/nginx-autoinstall\/master\/nginx-autoinstall.sh\nchmod +x nginx-autoinstall.sh\n.\/nginx-autoinstall.sh<\/code><\/pre>\n\n\n<p>\u6267\u884c\u4e4b\u540e\u4f1a\u6709\u51e0\u4e2a\u9009\u9879\uff0c\u5982\u679c\u53ea\u662f\u60f3\u5c1d\u9c9cHTTP3\uff0c\u5176\u4f59\u7684\u53ef\u4ee5\u90fd\u9009\u62e9\u4e0d\u5b89\u88c5\uff0c\u6bd4\u5982\u8bf4\uff1a<\/p>\n\n\n<pre class=\"wp-block-code\"><code>root@buzt.cn:~# .\/nginx-autoinstall.sh\nWelcome to the nginx-autoinstall script.\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\nSelect an option &#91;1-5]: 1\nThis script will install Nginx with some optional modules.\nDo you want to install Nginx stable or mainline?\n   1) Stable 1.18.0\n   2) Mainline 1.19.6\nSelect an option &#91;1-2]: 2\nPlease tell me which modules you want to install.\nIf you select none, Nginx will be installed with its default modules.\nModules to install :\n       HTTP\/3 (by Cloudflare, 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\nNginx is ready to be installed, press any key to continue...<\/code><\/pre>\n\n\n<p>\u5982\u679c\u5b89\u88c5\u8fc7\u7a0b\u6ca1\u6709\u95ee\u9898\uff0c\u8fd9\u4e2a\u5b89\u88c5\u811a\u672c\u5e94\u8be5\u80fd\u5e2e\u6211\u4eec\u5b8c\u6210Nginx\u7f16\u8bd1\u3001\u76f8\u5173\u6587\u4ef6\u76ee\u5f55\u521b\u5efa\u3001\u6587\u4ef6\u590d\u5236\u4ee5\u53ca\u6dfb\u52a0systemctl\u542f\u505c\u63a7\u5236\u811a\u672c\u7b49\u5de5\u4f5c\uff0c\u6211\u4eec\u53ea\u9700\u8981\u548c\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5\u7684Nginx\u4e00\u6837\u4f7f\u7528Nginx\u5c31\u884c\u4e86\u3002<\/p>\n\n\n<p>\u7f16\u8bd1\u5b8c\u4e4b\u540e\u67e5\u770bNginx\u7684\u7f16\u8bd1\u53c2\u6570\uff1a<\/p>\n\n\n<pre class=\"wp-block-code\"><code>root@buzt.cn:~# nginx -v\nnginx version: nginx\/1.19.6\nroot@buzt.cn:~# nginx -V\nnginx version: nginx\/1.19.6\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-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 --with-http_v3_module<\/code><\/pre>\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5f53\u524dNginx\u7248\u672c\u4e3a1.19.6\uff0c\u4e14\u5df2\u7ecf\u6dfb\u52a0\u4e86HTTP3\u652f\u6301\u3002<\/p>\n\n\n<h1 class=\"wp-block-heading\">Nginx\u6dfb\u52a0HTTP3\u652f\u6301<\/h1>\n\n\n<p>\u5982\u679c\u53ea\u662f\u9700\u8981\u542f\u7528HTTP3\u7684\u8bdd\uff0c\u53ef\u4ee5\u5c06\u4e0b\u5217\u914d\u7f6e\u6dfb\u52a0\u81f3\u73b0\u6709\u7684Nginx\u5bf9\u5e94\u7ad9\u70b9\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u76f8\u5173\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n\n\n<pre class=\"wp-block-code\"><code>server {\n        # Enable QUIC and HTTP\/3.\n        listen 443 quic reuseport;\n        # Enable HTTP\/2 (optional).\n        listen 443 ssl http2;\n        ssl_certificate      cert.crt;\n        ssl_certificate_key  cert.key;\n        # Enable all TLS versions (TLSv1.3 is required for QUIC).\n        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;\n        # Add Alt-Svc header to negotiate HTTP\/3.\n        add_header alt-svc 'h3-29=\":443\"; ma=86400';\n    }<\/code><\/pre>\n\n\n<p>\u91cd\u70b9\u662f\u6700\u540e\u9762\u54ea\u4e2aadd_header\u4e0d\u80fd\u5fd8\u4e86\uff0c\u9700\u8981\u901a\u8fc7\u8fd9\u4e2aheader\u901a\u77e5\u6d4f\u89c8\u5668\u5f53\u524d\u7ad9\u70b9\u652f\u6301HTTP3\u3002<\/p>\n\n\n<p>\u7f16\u8bd1\u8fc7\u7a0b\u4f7f\u7528\u4e86Cloudflare\u7684\u8865\u4e01\uff0c\u8be5\u8865\u4e01\u76ee\u524d\u652f\u6301HTTP3\u768429\u8349\u6848\uff0c\u6240\u4ee5\u7f16\u8bd1\u4e4b\u540e\u7684HTTP3\u4e5f\u662f\u652f\u630129\u8349\u6848\u3002<\/p>\n\n\n<p>\u56e0\u4e3aHTTP3\u4f7f\u7528\u7684\u662fUDP\u534f\u8bae\uff0c\u5982\u679c\u5f53\u524d\u670d\u52a1\u5668\u542f\u7528\u4e86\u9632\u706b\u5899\uff0c\u8fd8\u9700\u8981\u5728\u9632\u706b\u5899\u653e\u884cUDP\u534f\u8bae\u7684443\u7aef\u53e3\uff0c\u5982\u679c\u50cf\u662f\u56fd\u5185\u7684\u963f\u91cc\u4e91\u3001\u817e\u8baf\u4e91\u7b49\u4e91\u670d\u52a1\u5546\u9ed8\u8ba4\u5f00\u542f\u4e86\u5b89\u5168\u7ec4\u7684\uff0c\u8fd8\u9700\u8981\u5728\u5b89\u5168\u7ec4\u653e\u884cUDP\u7684443\u7aef\u53e3\u3002<\/p>\n\n\n<h1 class=\"wp-block-heading\">HTTP3\u7684\u5b9e\u9645\u4f7f\u7528\u4f53\u9a8c<\/h1>\n\n\n<p>\u672c\u7ad9\u5f00\u542fHTTP3\u622a\u56fe\uff1a<\/p>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/x.cloudbool.com\/img\/202104\/SFRQ4l.png\" alt=\"\"\/><\/figure>\n\n\n<p>\u8bf4\u5b9e\u8bdd\uff0c\u5c31\u6211\u76ee\u524d\u8fd9\u5c06\u8fd1\u4e00\u5e74\u591a\u7684HTTP3\u4f7f\u7528\u4f53\u9a8c\u6765\u8bf4\uff0c\u65e5\u5e38\u611f\u89c9\u548cHTTP2\u5dee\u522b\u4e0d\u5927\uff0c\u7531\u4e8eChrome\u3001Firefox\u3001Safari\u7b49\u6d4f\u89c8\u5668\u6682\u65f6\u8fd8\u4e0d\u662f\u9ed8\u8ba4\u652f\u6301\uff0cHTTP3\u7684\u4f7f\u7528\u9891\u7387\u5e76\u4e0d\u5927\uff0c\u518d\u52a0\u4e0a\u56fd\u5185\u7f51\u7edc\u5dee\u5f02\uff0c\u6709\u4e9b\u7f51\u7ad9\u5373\u4f7f\u652f\u6301\u4e86HTTP3\u534f\u8bae\uff0c\u65e5\u5e38\u8bbf\u95ee\u4e5f\u4e0d\u4e00\u5b9a\u662f\u8d70HTTP3\u534f\u8bae\uff0c\u53ef\u80fd\u540c\u6837\u7684\u7cfb\u7edf\u540c\u6837\u7684\u6d4f\u89c8\u5668\uff0c\u5728\u7535\u4fe1\u5bbd\u5e26\u4e0b\u80fd\u4f7f\u7528HTTP3\u534f\u8bae\u8bbf\u95ee\uff0c\u4f46\u662f\u5728\u79fb\u52a8\u5bbd\u5e26\u6216\u80054G\/5G\u73af\u5883\u4e0b\u5c31\u6ca1\u6cd5\u4f7f\u7528HTTP3\u534f\u8bae\u4e86\u3002<\/p>\n\n\n<p>\u518d\u8005\uff0c\u76ee\u524d\u7684HTTP3\u8fd8\u5b58\u5728\u4e0d\u5c11bug\uff0c\u5c31\u6211\u81ea\u5df1\u9047\u5230\u7684\u6765\u8bf4\uff0cChrome\u6d4f\u89c8\u5668\u5728\u4f7f\u7528HTTP3\u534f\u8bae\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0WordPress\u767b\u5f55\u9875\u5373\u4f7f\u8d26\u53f7\u5bc6\u7801\u6b63\u786e\u4e5f\u4f1a\u65e0\u6cd5\u767b\u5f55\u8fdb\u540e\u53f0\uff0c\u6216\u8005\u662f\u540e\u53f0\u7f16\u8f91\u6587\u7ae0\u4f1a\u51fa\u73b0\u7a81\u7136\u65e0\u6cd5\u63d0\u4ea4\u7684\u60c5\u51b5\uff0c\u66f4\u76f4\u63a5\u70b9\u5c31\u662f\uff0cHTTP3\u534f\u8bae\u4e0bChrome\u4f1a\u51fa\u73b0\u65e0\u6cd5POST\u6570\u636e\u7684\u60c5\u51b5\u3002<\/p>\n\n\n<p>\u76ee\u524d\u6765\u770b\uff0cHTTP3\u534f\u8bae\u7684\u5e7f\u6cdb\u4f7f\u7528\u8fd8\u4ecd\u9700\u65f6\u65e5\uff0c\u6211\u4e2a\u4eba\u662f\u975e\u5e38\u4e0d\u5efa\u8bae\u5728\u6b63\u5f0f\u73af\u5883\u4f7f\u7528\uff0c\u9047\u5230\u83ab\u540d\u5176\u5999\u7684bug\u5b9e\u5728\u662f\u6d6a\u8d39\u65f6\u95f4\u3002<\/p>\n\n\n<h2 class=\"wp-block-heading\">\u76f8\u5173\u9879\u76ee<\/h2>\n\n\n<p>nginx-autoinstall\uff1a<\/p>\n\n\n<p>https:\/\/github.com\/angristan\/nginx-autoinstall<\/p>\n\n\n<p>quiche\uff1a<\/p>\n\n\n<p>https:\/\/github.com\/cloudflare\/quiche\/tree\/master\/extras\/nginx#readme<\/p>\n","protected":false},"excerpt":{"rendered":"<p>HTTP3\u662fHTTP\u534f\u8bae\u7684\u7b2c\u4e09\u4e2a\u4e3b\u8981\u7248\u672c\uff0c\u662f\u7531Google\u5f00\u53d1\u7684QUIC\u534f\u8bae\u5f00\u53d1\u800c\u6765\uff0c\u8ddf\u76ee\u524d\u7684HTTP2\u76f8\u6bd4\uff0c &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/cloudbool.com\/archive\/nginx-autoinstall-http3.html\"> <span class=\"screen-reader-text\">Nginx\b\u542f\u7528HTTP3<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","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-1209","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/1209","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=1209"}],"version-history":[{"count":0,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/1209\/revisions"}],"wp:attachment":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/media?parent=1209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/categories?post=1209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/tags?post=1209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}