Nginx 1.25.1 版本后 http2 监听指令警告问题及解决方案

在 1.25.1 版本后的 nginx 运行日志中,会出现下面的警告:

“nginx: [warn] the "listen... http2" directive is deprecated, use the "http2" directive instead”文章源自堕落的鱼-https://www.duoluodeyu.com/2781.html

原因分析

http2 监听指令的用法发生了更改,以往的使用模式已被弃用。在 NGINX 1.25.1 中,listen... http2 指令被弃用,使用 nginx -t 进行配置检查时会发出警告。文章源自堕落的鱼-https://www.duoluodeyu.com/2781.html

解决方案

若原配置为 listen 443 ssl http2;,需修改为:文章源自堕落的鱼-https://www.duoluodeyu.com/2781.html

listen 443 ssl;
http2 on;

修改完成后,通过 sudo nginx -s reload 命令重启 nginx 使配置生效。文章源自堕落的鱼-https://www.duoluodeyu.com/2781.html

文章源自堕落的鱼-https://www.duoluodeyu.com/2781.html文章源自堕落的鱼-https://www.duoluodeyu.com/2781.html
 
1Panel面板的删除方法 网站建设

1Panel面板的删除方法

1Panel 是一款现代化的 Linux 服务器运维管理面板,主打 轻量化、安全性和容器化管理,通过可视化界面帮助用户高效管理服务器环境。它基于 Docker 架构,支持应用一键部署、网站与数据库管理...
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证