在 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