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 出现的错误
相关推荐
动恰客流统计4 小时前
ReID边缘计算视觉统计:餐饮店客流增长的数字化破局路径
java·大数据·运维·人工智能
△曉風殘月〆9 小时前
如何在Linux中安装Qt开发环境
linux·运维·qt
雨的旋律209911 小时前
ubuntu2604
linux·运维·服务器
Eloudy11 小时前
ubuntu 22.04安装 cuda 12.8.2
linux·运维·ubuntu
三言老师11 小时前
mkdir创建多级目录,目录创建基础实操
linux·运维·服务器
独孤--蝴蝶12 小时前
Docker容器进阶(一)
运维·docker·容器
he391237712 小时前
ogg命令
运维·网络
其实防守也摸鱼12 小时前
Kimi K3深度测评:长文本之外的真实力
运维·开发语言·网络·人工智能·python·学习·安全
imc.1112 小时前
linux EXT文件系统
linux·运维·服务器
用户07806253471914 小时前
getUserMedia 权限排障实战:浏览器拒绝,不一定是用户点了“拒绝”
nginx·webrtc