{"id":592,"date":"2020-02-25T11:48:13","date_gmt":"2020-02-25T03:48:13","guid":{"rendered":"https:\/\/cloudbool.com\/archive\/?p=592"},"modified":"2020-02-25T11:48:13","modified_gmt":"2020-02-25T03:48:13","slug":"nginx-http3","status":"publish","type":"post","link":"https:\/\/cloudbool.com\/archive\/nginx-http3.html","title":{"rendered":"Nginx\u542f\u7528HTTP3"},"content":{"rendered":"\n<p>\u4e4b\u524d\u8bf4\u5230<a href=\"https:\/\/cloudbool.com\/archive\/debian-10-build-nginx-add-google-brotli-purge-http3.html\">Debian 10\u91cd\u65b0\u6253\u5305Nginx\uff0c\u65b0\u589eGoogle\u3001Purge\u3001Brotli\u53caHTTP3\u7b49\u6a21\u5757<\/a>\uff0c\u628aNginx\u91cd\u65b0\u7f16\u8bd1\u6253\u5305\u52a0\u4e0a\u4e86HTTP3\u6a21\u5757\uff0c\u5b8c\u6210\u4e4b\u540e\u5fcd\u4e0d\u4f4f\u60f3\u628a\u8fd9\u4e2a\u6211\u6b63\u5728\u7528\u7684\u670d\u52a1\u5668\u4e5f\u7ed9\u5347\u7ea7\u4e00\u4e0b\uff0c\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0b\u6211\u7684\u914d\u7f6e\u8fc7\u7a0b\uff0c\u5e0c\u671b\u80fd\u7ed9\u6709\u540c\u6837\u9700\u6c42\u7684\u670b\u53cb\u53c2\u8003\u4e0b\u3002<\/p>\n\n\n<!--more-->\n\n\n<h1 class=\"wp-block-heading\">Nginx\u5f00\u542fHTTP3\u914d\u7f6e<\/h1>\n\n\n<p>\u6211\u73b0\u5728\u8fd9\u4e2a\u7f51\u7ad9\u4f7f\u7528\u7684\u670d\u52a1\u5668\u662f\u817e\u8baf\u4e91\uff0c\u7cfb\u7edf\u4e3aDebian 10 x64\uff0cNginx\u7248\u672c\u4e3a1.16.1\uff0c\u7f16\u8bd1\u8fc7\u7a0b\u89c1\u4e0a\u9762\u94fe\u63a5\uff0c\u535a\u5ba2\u7cfb\u7edf\u4f7f\u7528\u7684\u662fWordPress\uff0cPHP\u7248\u672c\u662fDebian10\u81ea\u5e26\u76847.3.14\uff0c\u6298\u817e\u4e4b\u540e\u7684\u5b8c\u6574Nginx\u914d\u7f6e\u6587\u4ef6\u5982\u4e0b\uff1a<\/p>\n\n\n<pre class=\"wp-block-code\"><code>server{\n        listen 443 ssl http2;\n        listen &#91;::]:443 ssl http2;\n        listen 443 quic reuseport;\n        listen &#91;::]:443 quic reuseport;\n        server_name  cloudbool.com;\n        index index.html index.php;\n        root  \/path\/to\/cloudbool\/;\n        ssl_certificate \/path\/to\/ssl\/cloudbool-wildcard.crt;\n        ssl_certificate_key \/path\/to\/ssl\/cloudbool-wildcard.key;\n        ssl_session_cache        shared:SSL:10m;\n        ssl_session_timeout      10m;\n        ssl_session_tickets      on;\n        ssl_session_cache builtin:1000 shared:SSL:10m;\n        ssl_dhparam \/path\/to\/ssl\/dhparam.pem;\n        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;\n        add_header Strict-Transport-Security \"max-age=63072000; includeSubDomains; preload\" always;\n        add_header alt-svc 'h3-29=\":443\"; ma=86400';\n        location ~ \/(wp-content|uploads|wp-includes|images)\/.*\\.php$\n        {\n                deny all;\n        }\n        location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf)$\n        {\n                expires      30d;\n        }\n        location ~ .*\\.(js|css)?$\n        {\n                expires      12h;\n        }\n        location ~ \/\\.\n        {\n                deny all;\n        }\n        client_max_body_size    2m;\n        access_log \/var\/log\/nginx\/cloudbool.log;\n        error_log \/var\/log\/nginx\/cloudbool-error.log;\n        error_page 404 \/404.html;\n        error_page 500 502 503 504 \/50x.html;\n        location = \/50x.html {\n                root \/usr\/share\/nginx\/html;\n        }\n        location ~ \\.php$ {\n                try_files $uri \/index.php =404;\n                fastcgi_split_path_info ^(.+\\.php)(\/.+)$;\n                fastcgi_pass unix:\/run\/php\/php7.3-fpm.sock;\n                fastcgi_index index.php;\n                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n                include fastcgi_params;\n        }\n}\nserver\n{\n        listen          80;\n        server_name cloudbool.com;\n        location \/ {\n                rewrite ^\/(.*)$ https:\/\/cloudbool.com\/archive\/$1 permanent;\n        }\n}\n<\/code><\/pre>\n\n\n<p>2021-02-23 Update\uff1a<\/p>\n\n\n<p>\u91cd\u65b0\u7f16\u8bd1\u4e86\u4e00\u4e0bNginx\uff0c\u5c06HTTP3\u8349\u6848\u7248\u672c\u652f\u6301\u5230\u4e8629\u3002<\/p>\n\n\n<h1 class=\"wp-block-heading\">\u653e\u884cUDP 443\u7aef\u53e3<\/h1>\n\n\n<p>HTTP3\u7684\u6280\u672f\u539f\u7406\u6211\u5c31\u4e0d\u53bb\u4e0d\u61c2\u88c5\u61c2\u53bb\u8d58\u8ff0\u4e86\uff0c\u5bf9\u4e8e\u56fd\u5185\u7684\u4e91\uff0c\u8fd8\u662f\u9700\u8981\u653e\u884cUDP 443\u7aef\u53e3\u7684\uff0c\u6bd5\u7adfHTTP3\u8d70\u7684\u662fUDP\u534f\u8bae\uff0c\u914d\u7f6e\u5b8c\u4e4b\u540e\u6211\u4f7f\u7528Firefox\u6d4b\u8bd5\u53d1\u73b0\u8d70\u7684\u8fd8\u662fHTTP2\uff0c\u5982\u56fe\uff1a<br \/><img decoding=\"async\" src=\"https:\/\/x.cloudbool.com\/img\/2020\/02\/25\/http3.png\" alt=\"http3.png\"><\/p>\n\n\n<p>\u7136\u540e\u68c0\u67e5\u4e86\u4e0b\u914d\u7f6e\uff0c\u60f3\u4e86\u60f3\uff0c\u5e94\u8be5\u662fUDP\u7684443\u7aef\u53e3\u6ca1\u653e\u884c\uff0c\u7136\u540e\u5230\u817e\u8baf\u4e91\u5b89\u5168\u7ec4\u52a0\u4e86\u6761\u89c4\u5219\uff0c\u5982\u56fe\uff1a<br \/><img decoding=\"async\" src=\"https:\/\/x.cloudbool.com\/img\/2020\/02\/25\/tencent-cloud-server-add-udp-443.png\" alt=\"tencent-cloud-server-add-udp-443.png\"><\/p>\n\n\n<p>\u7136\u540e\u5237\u65b0\u6d4f\u89c8\u5668\uff0c\u518d\u6b21\u6d4b\u8bd5\u53d1\u73b0\u8d70\u7684\u5c31\u662fHTTP3\u4e86\uff0c\u5982\u56fe\uff1a<br \/><img decoding=\"async\" src=\"https:\/\/x.cloudbool.com\/img\/2020\/02\/25\/http3-test-result.png\" alt=\"http3-test-result.png\"><\/p>\n\n\n<p>\u987a\u5e26\u4e00\u63d0\uff0c\u6211\u662f\u7528\u7684\u662fmacOS\uff0c\u65e5\u5e38\u4f7f\u7528\u7684\u662fGoogle Chrome\uff0c\u6211\u6ca1\u6709\u627e\u5230\u80fd\u5728\u547d\u4ee4\u884c\u52a0\u53c2\u6570\u542f\u52a8\u7684\u529e\u6cd5\uff0c\u6240\u4ee5\u6211\u4f7f\u7528\u7684\u662f\u6700\u65b0\u7248\u7684Firefox\uff0c\u542f\u7528HTTP3\u5f88\u7b80\u5355\uff0c\u6253\u5f00<strong>about:config<\/strong> \u9875\u9762\uff0c\u7136\u540e\u542f\u7528<strong>network.http.http3.enabled<\/strong> \uff0c\u518d\u6253\u5f00\u5f00\u53d1\u8005\u5de5\u5177\u5c31\u80fd\u770b\u5230\u4e86\u3002<\/p>\n\n\n<h1 class=\"wp-block-heading\">HTTP3\u7f51\u7ad9\u6f14\u793a<\/h1>\n\n\n<p>\u672c\u7ad9\u76ee\u524d\u5c31\u914d\u7f6e\u4e86HTTP3\uff0c\u6309\u7167\u4e0a\u8ff0\u914d\u7f6e\u8c03\u6574\u597d\u6d4f\u89c8\u5668\u5c31\u80fd\u770b\u5230\u5b9e\u9645\u6548\u679c\u3002<\/p>\n\n\n<h1 class=\"wp-block-heading\">HTTP3\u9047\u5230\u7684bug<\/h1>\n\n\n<p>\u7ecf\u8fc7\u6211\u8fd9\u51e0\u4e2a\u6708\u7684\u5b9e\u9645\u4f7f\u7528\uff0c\u76ee\u524d\u5df2\u77e5\u7684bug\u5c31\u662f\u65e0\u6cd5\u914d\u7f6eRSA\u53caECC\u53cc\u8bc1\u4e66\uff0c\u5355\u72ec\u4f7f\u7528RSA\u6216\u8005ECC\u8bc1\u4e66\u90fd\u6ca1\u95ee\u9898\uff0c\u5982\u679c\u914d\u7f6eRSA\u53caECC\u53cc\u8bc1\u4e66\u4f1a\u51fa\u73b0\u53ea\u4f7f\u7528RSA\u8bc1\u4e66\u7684\u60c5\u51b5\uff0c\u6d4b\u8bd5\u4e86\u5f88\u591a\u914d\u7f6e\u90fd\u662f\u8fd9\u6837\uff0c\u4e0d\u77e5\u9053\u662f\u6211\u914d\u7f6e\u6709\u95ee\u9898\u8fd8\u662f\u8fd9\u4e2a\u7248\u672c\u5b58\u5728bug\uff1f<\/p>\n\n\n<h1 class=\"wp-block-heading\">\u63d0\u793a<\/h1>\n\n\n<p>\u5e76\u4e0d\u662f\u6240\u6709\u7f51\u7edc\u90fd\u80fd\u6210\u529f\u4f7f\u7528HTTP3\u534f\u8bae\uff0c\u540c\u4e00\u4e2a\u7f51\u7ad9\uff0c\u6211\u8fd9\u8fb9\u7684\u6d4b\u8bd5\u663e\u793a\uff0c\u7535\u4fe1\u7f51\u7edc\u65e0\u6cd5\u542f\u7528HTTP3\uff0c\u4f46\u662f\u79fb\u52a8\u5bbd\u5e26\u4e0b\u5374\u80fd\u6210\u529f\u542f\u7528\uff0c\u5177\u4f53\u539f\u56e0\u672a\u77e5\uff0c\u731c\u6d4b\u8ddf\u8fd0\u8425\u5546\u5bf9UDP\u7684QOS\u6709\u5173\uff1f<\/p>\n\n\n<p>\u5efa\u8bae\u9700\u8981\u8003\u8651\u6d4f\u89c8\u5668\u8bc1\u4e66\u517c\u5bb9\u6027\u7684\u573a\u666f\u8fd8\u662f\u5148\u4e0d\u8981\u5c1d\u9c9c\uff0c\u7b49\u7a33\u5b9a\u4e00\u70b9\u518d\u4e0a\u3002<\/p>\n\n\n<p><strong>\u6298\u817e\u5b8c\u53d1\u73b0\uff0c\u597d\u50cf\u76ee\u524d\u6765\u8bf4\u5e76\u6ca1\u6709\u591a\u5927\u7528\u51fa\uff0c\u6bd5\u7adf\u5927\u591a\u6570\u6d4f\u89c8\u5668\u5f53\u524d\u90fd\u8fd8\u4e0d\u652f\u6301HTTP3\u3002<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u8bf4\u5230Debian 10\u91cd\u65b0\u6253\u5305Nginx\uff0c\u65b0\u589eGoogle\u3001Purge\u3001Brotli\u53caHTTP3\u7b49\u6a21\u5757\uff0c\u628a &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/cloudbool.com\/archive\/nginx-http3.html\"> <span class=\"screen-reader-text\">Nginx\u542f\u7528HTTP3<\/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":[9],"tags":[27,153,158,76],"class_list":["post-592","post","type-post","status-publish","format-standard","hentry","category-mess","tag-debian","tag-debian-10","tag-http3","tag-nginx"],"_links":{"self":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/592","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=592"}],"version-history":[{"count":0,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/592\/revisions"}],"wp:attachment":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/media?parent=592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/categories?post=592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/tags?post=592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}