V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
httpbin - 协议调试工具
httpstatuses - 协议状态码查询
httpie - cURL-like tool for humans
Fiddler
weiruanniubi
V2EX  ›  HTTP

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

  •  2
     
  •   weiruanniubi · 2020-05-23 13:26:07 +08:00 · 2293 次点击
    这是一个创建于 1424 天前的主题,其中的信息可能已经有所发展或是发生改变。

    测试站点是: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;
            }
        }
    }
    
    Nangle
        1
    Nangle  
       2020-05-23 13:34:42 +08:00 via iPhone   ❤️ 1
    看下我这篇文章,看对你有用不。
    https://www.nange.cn/quic-and-http3-for-nginx.html
    GeekSky
        2
    GeekSky  
       2020-05-23 13:50:48 +08:00
    @Nangle 老哥,我把 alt-svc 头换成了你的,现在可以通过 HTTP/3 的测试了。
    只是在各大浏览器上,依然是 HTTP/2 。
    Livid
        3
    Livid  
    MOD
       2020-05-23 14:13:18 +08:00
    @GeekSky Chrome 里需要打开额外的 flags
    Nangle
        4
    Nangle  
       2020-05-23 15:06:36 +08:00
    @GeekSky 目前大部分浏览器默认还不支持,即使支持也需要手动开启才行。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5099 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 05:37 · PVG 13:37 · LAX 22:37 · JFK 01:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.