模块 ngx_http_v3_module
该模块 (1.25.0) 为HTTP/3ngx_http_v3_module提供实验性支持
。
该模块不是默认构建的,需要通过
--with-http_v3_module
配置参数启用。
建议 使用提供 QUIC 支持的 SSL 库(例如 BoringSSL、 LibreSSL或 QuicTLS )来构建和运行此模块。否则,在使用OpenSSL库时,将使用不支持 早期数据的OpenSSL兼容层。
已知的问题
该模块是实验性的,买者自负。
配置示例
http {
log_format quic '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$http3"';
access_log logs/access.log quic;
server {
# for better compatibility it's recommended
# to use the same port for http/3 and https
listen 8443 quic reuseport;
listen 8443 ssl;
ssl_certificate certs/example.com.crt;
ssl_certificate_key certs/example.com.key;
location / {
# used to advertise the availability of HTTP/3
add_header Alt-Svc 'h3=":8443"; ma=86400';
}
}
}
请注意,通过 TLS 接受 HTTP/3 连接需要 TLSv1.3 协议支持,该支持自 OpenSSL版本 1.1.1 起提供。
指令
| 句法: |
http3 |
|---|---|
| 默认: |
http3 on; |
| 语境: |
http,server |
启用 HTTP/3 协议协商。
| 句法: |
http3_hq |
|---|---|
| 默认: |
http3_hq off; |
| 语境: |
http,server |
启用QUIC 互操作性测试 中使用的 HTTP/0.9 协议协商 。
| 句法: |
http3_max_concurrent_streams |
|---|---|
| 默认: |
http3_max_concurrent_streams 128; |
| 语境: |
http,server |
设置连接中并发 HTTP/3 请求流的最大数量。
| 句法: |
http3_stream_buffer_size |
|---|---|
| 默认: |
http3_stream_buffer_size 64k; |
| 语境: |
http,server |
设置用于读取和写入 QUIC 流的缓冲区的大小。
| 句法: |
quic_active_connection_id_limit |
|---|---|
| 默认: |
quic_active_connection_id_limit 2; |
| 语境: |
http,server |
设置 QUICactive_connection_id_limit传输参数值。这是服务器上可以存储的客户端连接 ID 的最大数量。
| 句法: |
quic_bpf |
|---|---|
| 默认: |
quic_bpf off; |
| 语境: |
main |
使用eBPF 启用 QUIC 数据包的路由 。启用后,这允许支持 QUIC 连接迁移。
该指令仅在 Linux 5.7+ 上受支持。
| 句法: |
quic_gso |
|---|---|
| 默认: |
quic_gso off; |
| 语境: |
http,server |
使用分段卸载以优化的批处理模式启用发送。
仅在 Linux 上支持优化发送UDP_SEGMENT。
| 句法: |
quic_host_key |
|---|---|
| 默认: | — |
| 语境: |
http,server |
设置file用于加密无状态重置和地址验证令牌的密钥。默认情况下,每次重新加载时都会生成一个随机密钥。不接受使用旧密钥生成的令牌。
| 句法: |
quic_retry |
|---|---|
| 默认: |
quic_retry off; |
| 语境: |
http,server |
启用
QUIC 地址验证功能。Retry这包括在数据包或帧中发送新令牌NEW_TOKEN以及验证数据包中接收到的令牌Initial。
嵌入变量
该ngx_http_v3_module模块支持以下嵌入变量:
$http3-
协商协议标识符:“
h3”表示 HTTP/3 连接,“hq”表示 hq 连接,否则为空字符串。
