moeYuiYui / lnmp

LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RHEL/Fedora/Aliyun/Amazon、Debian/Ubuntu/Raspbian/Deepin/Mint Linux VPS或独立主机安装LNMP(Nginx/MySQL/PHP)、LNMPA(Nginx/MySQL/PHP/Apache)、LAMP(Apache/MySQL/PHP)生产环境的Shell程序。
https://lnmp.org
Other
111 stars 59 forks source link

适配了nginx对http2协议的更改 #4

Closed KyoSakuyo closed 3 weeks ago

KyoSakuyo commented 3 months ago

避免了在更新到nginx1.25.1后,制作站点时出现的warn报错。

Nginx在1.25.0版本中实验性的支持HTTP/3后,在1.25.1版本中弃用了listen指令的http2参数,单独加入了http2指令。

the “listen … http2” directive is deprecated异常

如果Nginx1.25.1及以后版本中,进行如下方式的配置:

listen 443 ssl http2;

listen [::]:443 ssl http2;

当执行nginx -t进行检查配置或重启Nginx时,会提示如下错误:

 [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的配置文件中采用了上述旧的语法格式导致的。

此时,将对应的配置修改为如下方式即可:

listen       443 ssl;

listen       [::]:443 ssl;

同时,如果配置了ssl on,需要去掉ssl on配置。

修改完毕,重启Nginx即可生效。 参考:https://blog.csdn.net/wo541075754/article/details/132722406