Nginx 启用 HTTP/3(QUIC) 与回退策略实战基本配置server {
listen 443 ssl http2;
listen 443 quic reuseport;
server_name example.com;
ssl_certificate /etc/nginx/certs/server.crt;
ssl_certificate_key /etc/nginx/certs/server.key;
ssl_protocols TLSv1.3;
add_header Alt-Svc 'h3=":443"; ma=86400';
location / {
root /var/www/html;
index index.html;
}
}
验证与回退浏览器开发者工具确认 `Alt-Svc: h3` 与协议为 `h3`无法使用 h3 时自动回退到 HTTP/2/1.1总结通过 `listen quic` 与 `Alt-Svc` 宣告,结合 TLS1.3,可平滑启用 HTTP/3 并兼容旧协议。

发表评论 取消回复