香港/韩国云服务器、独立服务器租用

nginx: [warn] the "listen ... http2" directive is deprecated

自营机房/高防服务器/高防VPS/美国高防/洛杉矶VPS/洛杉矶高防服务器

在新服务器上使用原vhost配置文件应用时出现报错:

root@zrblog:~# /usr/local/nginx/sbin/nginx -t
nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /usr/local/nginx/conf/vhost/vpsaa.com.conf:72
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

查了下,这是Nginx配置文件/usr/local/nginx/conf/vhost/zrblog.net.conf 的第72行使用了过时的语法listen ... http2,Nginx 建议使用单独的http2指令来启用 HTTP/2,需要将原来的:

listen 443 ssl http2;
#listen [::]:443 ssl http2;

修改为:

listen 443 ssl;
#listen [::]:443 ssl;
http2 on;

完成后再试OK!

/usr/local/nginx/sbin/nginx -t
service nginx reload

本站QQ群:683851361,商家投稿邮箱:zrblog@qq.com

分享到
便宜VPS/10美元VPS/洛杉矶、圣何塞等多个机房