首先你需要安装Lnmp, LNMP 一键安装包 安装后即可开始进行操作。
第一步,给 nginx 打 patch
下载 quiche
git clone --recursive https://github.com/cloudflare/quiche
BashCopy
进入 lnmp1.6/src
目录解压 nginx
tar xzvf nginx-1.16.1.tar.gz
BashCopy
进入源码目录打 patch
cd nginx-1.16.1
patch -p01 < /path/to/quiche/extras/nginx/nginx-1.16.patch
BashCopy
返回上级目录重新打包并替换
rm nginx-1.16.1.tar.gz
tar czvf nginx-1.16.1.tar.gz nginx-1.16.1
rm -r nginx-1.16.1
BashCopy
第二步,安装 nginx
修改 lnmp.conf
Nginx_Modules_Options='--with-http_v3_module --with-openssl=/path/to/quiche/deps/boringssl --with-quiche=/path/to/quiche'
Enable_Nginx_Openssl='n'
ConfCopy
安装 rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
BashCopy
修改安装脚本
在 lnmp1.6/include/upgrade_nginx.sh
第二行处添加 rust 的 PATH
export PATH="/path/to/.cargo/bin:$PATH"
BashCopy
否则编译会因为 /bin/sh: 1: cargo: not found
失败。
开始编译
执行 lnmp1.6/upgrade.sh nginx
,输入版本号 1.16.1
并确认,等待安装成功。
配置 nginx
修改 website.conf
server {
# Enable QUIC and HTTP/3.
listen 443 quic reuseport;
# Enable HTTP/2 (optional).
listen 443 ssl http2;
ssl_certificate cert.crt;
ssl_certificate_key cert.key;
# Enable all TLS versions (TLSv1.3 is required for QUIC).
ssl_protocols TLSv1.3 TLSv1.2;
# Add Alt-Svc header to negotiate HTTP/3.
add_header alt-svc 'h3-23=":443"; ma=86400';
}
重载 nginx lnmp nginx reload
后生效。
如若转载,请注明出处:https://www.ozabc.com/jianzhan/3159.html