Nginx1.25.1起弃用 Listen 指令的 Http2 参数

Nginx在1.25.0版本中实验性的支持HTTP/3后,在1.25.1版本中弃用了listen指令的http2参数,单独加入了http2指令。

the "listen ... http2" directive is deprecated异常

如果Nginx1.25.1及以后版本中,进行如下方式的配置:

bash 复制代码
listen 443 ssl http2;
listen [::]:443 ssl http2;

当执行nginx -t进行检查配置或重启Nginx时,会提示如下错误:

bash 复制代码
 [warn] : the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/s.conf:12
 
nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/s.conf:12

主要原因就是在Nginx的配置文件中采用了上述旧的语法格式导致的。

此时,将对应的配置修改为如下方式即可:

bash 复制代码
listen       443 ssl;
listen       [::]:443 ssl;

同时,如果配置了ssl on,需要去掉ssl on配置。

修改完毕,重启Nginx即可生效。

Nginx 1.25.1更新日志

Nginx 1.25.1版本,做了如下的更新:

  • Feature: "http2" 指令支持在每个服务器上启用 HTTP/2,"listen" 指令的 "http2" 参数已被弃用
  • Change: 移除 HTTP/2 服务器推送支持
  • Change: 不再支持被弃用的 "ssl" 指令
  • Bugfix: 修复使用 OpenSSL 时在 HTTP/3 出现的错误
相关推荐
少妇的美梦5 小时前
logstash教程
运维
chen9455 小时前
k8s集群部署vector日志采集器
运维
chen9455 小时前
aws ec2部署harbor,使用s3存储
运维
東雪蓮☆10 小时前
深入理解 LVS-DR 模式与 Keepalived 高可用集群
linux·运维·服务器·lvs
qq_2642208910 小时前
LVS负载均衡群集和LVS+Keepalived群集
运维·负载均衡·lvs
乌萨奇也要立志学C++11 小时前
【Linux】进程概念(二):进程查看与 fork 初探
linux·运维·服务器
雨落Liy11 小时前
Nginx 从入门到进阶:反向代理、负载均衡与高性能实战指南
运维·nginx·负载均衡
Yyyy48211 小时前
Nginx负载均衡集群实验步骤
运维·nginx·负载均衡
獭.獭.13 小时前
Linux -- 信号【上】
linux·运维·服务器
hashiqimiya13 小时前
centos配置环境变量jdk
linux·运维·centos