使用 CF 的 HTTP/3 补丁安装 NGINX 并搭建了网站,为什么还是显示 HTTP/2 呢?

2020-05-23 13:26:07 +08:00
 weiruanniubi

测试站点是:test.geeksky.org
各大浏览器均显示是 HTTP/2,各个 HTTP/3 测试工具均显示:无法建立 QUIC 连接。
系统防火墙已经关闭,安全组全部放行。
以下是操作全过程,希望大神能够指点迷津,不胜感激:

wget https://nginx.org/download/nginx-1.16.1.tar.gz
tar zxf nginx-1.16.1.tar.gz
git clone --recursive https://github.com/cloudflare/quiche
cd nginx-1.16.1
patch -p01 < /root/quiche/extras/nginx/nginx-1.16.patch
./configure --prefix=/usr/local/nginx --user=nobody --group=nobody --with-http_ssl_module --with-http_v2_module --with-http_v3_module --with-openssl=/root/quiche/deps/boringssl --with-quiche=/root/quiche && make && make install

下面是 NGINX 配置文件:

worker_processes  1;

events {
    use  epoll;
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    gzip  on;
    gzip_types  text/css application/javascript image/jpeg image/gif image/png image/webp;

    server {
        listen 443 quic reuseport;
        listen 443 ssl http2;
        server_name  test.geeksky.org;
        add_header alt-svc 'h3-25=":443"; ma=86400';

        ssl_certificate      /usr/local/nginx/ssl/www.crt;
        ssl_certificate_key  /usr/local/nginx/ssl/www.key;
        ssl_protocols        TLSv1.2 TLSv1.3;

        location / {
            root   html;
            index  index.html;
        }
    }
}
2299 次点击
所在节点    HTTP
4 条回复
Nangle
2020-05-23 13:34:42 +08:00
看下我这篇文章,看对你有用不。
https://www.nange.cn/quic-and-http3-for-nginx.html
GeekSky
2020-05-23 13:50:48 +08:00
@Nangle 老哥,我把 alt-svc 头换成了你的,现在可以通过 HTTP/3 的测试了。
只是在各大浏览器上,依然是 HTTP/2 。
Livid
2020-05-23 14:13:18 +08:00
@GeekSky Chrome 里需要打开额外的 flags
Nangle
2020-05-23 15:06:36 +08:00
@GeekSky 目前大部分浏览器默认还不支持,即使支持也需要手动开启才行。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/674649

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX