nginx开启http/3

apt install --no-install-recommends -y \
        build-essential software-properties-common flex bison \
        libpcre3-dev libpcre++-dev libxml2 libxml2-dev \
        libcurl4 doxygen libyajl2 libyajl-dev geoip-bin libgeoip1 libgeoip-dev libtool dh-autoreconf libcurl4-openssl-dev \
        zlib1g-dev unzip git wget unzip language-pack-zh-hans libhiredis-dev libhiredis0.13 libuuid1 uuid-dev \
        cmake golang-go libunwind-dev rustc cargo

其中cmake golang-go libunwind-dev rustc cargo这几个包是编译quiche需要的
具体的编译方法看这里
https://github.com/cloudflare/quiche/tree/master/extras/nginx
alt-svc我的用法是


    map $scheme:$http3 $altsvc_header {
        default "";
        https: 'h3-25=":443"; ma=2592000, h3-24=":443"; ma=2592000, h3-23=":443"; ma=2592000';
    }
    add_header Alt-Svc $altsvc_header;

其中map指令要写在http段中
浏览器开启http/3的方法

  1. chrome
    在快捷方式中加入--enable-quic --quic-version=h3-24参数
    图片.png

    对于http/3的草案版本号,要根据浏览器版本来确定,chrome80就是h3-24,如果版本号不对是无法开启的,这个得自己一个一个去试。
    2.firefox
    进入about:config
    找到network.http.http3.enabled,设为true
    firefox不需要指定版本,不过firefox支持的应该也是h3-24或h3-23,chrome canary支持到了h3-25.
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容