前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Nginx1.25.1起弃用 Listen 指令的 Http2 参数,异常:the “listen ... http2“ directive is deprecated

Nginx1.25.1起弃用 Listen 指令的 Http2 参数,异常:the “listen ... http2“ directive is deprecated

作者头像
程序新视界
发布2023-09-07 10:47:19
2.1K0
发布2023-09-07 10:47:19
举报
文章被收录于专栏:丑胖侠丑胖侠

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

the “listen … http2” directive is deprecated异常

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

代码语言:javascript
复制
listen 443 ssl http2;
listen [::]:443 ssl http2;

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

代码语言:javascript
复制
 [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的配置文件中采用了上述旧的语法格式导致的。

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

代码语言:javascript
复制
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 出现的错误
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2023-09-06,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • the “listen … http2” directive is deprecated异常
  • Nginx 1.25.1更新日志
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档