说明
给 openresty 加上 http3/quic 支持,使用 cloudflare/quiche 和 kn007/patch 来实现。本文中使用 debian 系统编译,openresty 版本号为 1.21.4.1。并没有测试编译出来的 openresty 好不好用。
下载源代码
wget https://openresty.org/download/openresty-1.21.4.1.tar.gz
tar zxvf openresty-1.21.4.1.tar.gz
git clone --recursive https://github.com/cloudflare/quiche
wget https://github.com/kn007/patch/raw/master/nginx_with_quic.patch
安装依赖
sudo apt install -y build-essential libpcre3-dev libssl-dev perl
#安装rust
wget https://sh.rustup.rs -O rustup.sh
bash rustup.sh -y
#设置环境变量
source "$HOME/.cargo/env"
安装nginx的http3补丁
#进入 openresty 源码目录
cd openresty-1.21.4.1
#进入 nginx 源码目录
cd bundle/nginx-1.21.4/
#打补丁
patch -p01 < ../../../nginx_with_quic.patch
编译openresty
#进入 openresty 源码目录
cd openresty-1.21.4.1
./configure --with-http_ssl_module --with-http_v2_module --with-http_v3_module --with-openssl=$PWD/../quiche/quiche/deps/boringssl --with-quiche=$PWD/../quiche
gmake
sudo gmake install
配置openresty
server {
listen 443 quic reuseport;
listen 443 ssl http2;
ssl_certificate cert.crt;
ssl_certificate_key cert.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
add_header alt-svc 'h3=":443"; ma=86400';
}
文章评论