查看: 533|回复: 0

oneinstack提示nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in的解决方法

[复制链接]

19

主题

0

回帖

57

积分

注册会员

积分
57
发表于 2025-4-19 11:19:54 | 显示全部楼层 |阅读模式
将nginx更新到1.26.1后,执行nginx -t提示 nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in,以为是更新nginx1.26.1出现错误,搜索后才明白是nginx1.25.1版本开始对配置文件弃用了一些旧指令。
Image



解决方法很简单,找到网站的nginx配置文件,本站服务器使用oneinstack脚本管理的,网站的nginx文件路径为 /usr/local/nginx/conf/vhost,只需要将这个路径下的所有网站的nginx文件打开,去掉http2。
修改前:
listen 443 ssl http2;
listen [::]:443 ssl http2;
Image



修改后:
listen 443 ssl;
listen [::]:443 ssl;
Image



然后执行service nginx restart 重启nginx服务,再执行 nginx -t 命令,已没有警告提示信息。
Image




您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|青ICP备2025004122号-1

在本版发帖
关注公众号
返回顶部