本站自 2021/03/29 起,已由Nginx官方项目 Nginx-quic 迁移至由CloudFlare的quiche 实现的 Nginx http3
原因
在使用Nginx官方项目 Nginx-quic 时,经常会出现400的错误 我不能接受 所以用回了 Quiche 一切正常
踩坑
因为编译用的Nginx是最新版本的(1.19.8),所以quiche官方的patch已经无法再使用 原因是 在Nginx 1.19.7版本 post_accept_timeout
已经被移除 但是在 同一个commit 中我发现了一个替换的方法
cscf = ngx_http_get_module_srv_conf(hc->conf_ctx,ngx_http_core_module);
ngx_add_timer(rev, cscf->client_header_timeout);
懒得自己改的话也可以使用我的 patch
使用方法是 patch -p01 < ../patch/nginx.patch
在编译的时候可能会出现一些报错
In file included from ../quiche/deps/boringssl/.openssl/include/openssl/ex_data.h:114,
from ../quiche/deps/boringssl/.openssl/include/openssl/bio.h:66,
from ../quiche/deps/boringssl/.openssl/include/openssl/ssl.h:147,
from src/event/ngx_event_openssl.h:15,
from src/core/ngx_core.h:84,
from ../../incubator-pagespeed-ngx-1.14.33.1-RC1/src/log_message_handler.h:27,
from ../../incubator-pagespeed-ngx-1.14.33.1-RC1/src/log_message_handler.cc:24:
../quiche/deps/boringssl/.openssl/include/openssl/stack.h: 在函数‘int sk_OPENSSL_STRING_call_cmp_func(stack_cmp_func, const void**, const void**)’中:
../quiche/deps/boringssl/.openssl/include/openssl/stack.h:298:26: 错误:type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
298 | constptrtype a_ptr = (constptrtype)*a; \
| ^~~~~~~~~~~~~~~~
···············································································
解决方法:
vim ./objs/Makefile
#在第三行
CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g
#删掉 -Werror 再次进行make编译即可 修改后为
CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g
结语
等待Nginx-quic项目成熟后还是会移回nginx-quic的 也可能是我个人的配置问题