在新服务器上使用原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














