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 出现的错误
相关推荐
feilieren13 分钟前
Docker 安装 Elasticsearch 9
运维·elasticsearch·docker·es
小皮侠1 小时前
nginx的使用
java·运维·服务器·前端·git·nginx·github
Maki Winster2 小时前
在 Ubuntu 下配置 oh-my-posh —— 普通用户 + root 各自使用独立主题(共享可执行)
linux·运维·ubuntu
翻滚吧键盘2 小时前
debian及衍生发行版apt包管理常见操作
运维·debian
Charlene Fung3 小时前
vs code远程自动登录服务器,无需手动输入密码的终极方案(windows版)
运维·服务器·vscode·ssh
碣石潇湘无限路3 小时前
【部署与总结】从本地运行到公网服务器的全过程
运维·服务器
linux修理工4 小时前
ipmitool 使用简介(ipmitool sel list & ipmitool sensor list)
运维·服务器
XM-54584 小时前
2025微信小程序wxapkg解包全攻略
linux·运维·小程序
朗晴4 小时前
文本编辑器VIM的使用方法!
linux·运维·服务器
小林up5 小时前
github push:ssh: connect to host github.com port 22
运维·ssh·github