oneinstack提示nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in的解决方法
将nginx更新到1.26.1后,执行nginx -t提示 nginx: the "listen ... http2" directive is deprecated, use the "http2" directive instead in,以为是更新nginx1.26.1出现错误,搜索后才明白是nginx1.25.1版本开始对配置文件弃用了一些旧指令。Imagehttps://atuwe.com/sites/default/files/styles/wide/public/2024-07/120240706183235.webp?itok=bR_kdSa5
解决方法很简单,找到网站的nginx配置文件,本站服务器使用oneinstack脚本管理的,网站的nginx文件路径为 /usr/local/nginx/conf/vhost,只需要将这个路径下的所有网站的nginx文件打开,去掉http2。修改前:
listen 443 ssl http2;
listen [::]:443 ssl http2;Image
https://atuwe.com/sites/default/files/styles/wide/public/2024-07/220240706181313.webp?itok=aP2GPSus
修改后:
listen 443 ssl;
listen [::]:443 ssl;Image
https://atuwe.com/sites/default/files/styles/wide/public/2024-07/320240706181411.webp?itok=_M44Ra64
然后执行service nginx restart 重启nginx服务,再执行 nginx -t 命令,已没有警告提示信息。Image
https://atuwe.com/sites/default/files/styles/wide/public/2024-07/420240706181933.webp?itok=4HE_Q5Nb
页:
[1]