开启之前,protocol显示http/1.1
1.进入下载的nginx安装目录
./configure --with-http_v2_module --with-http_ssl_module
make && make install
2.http2需要ssl支持,需要开启https
修改 conf
listen 443 ssl http2;
3.重新启动nginx
修改conf后 先./nginx -t查看是否有错误
然后./nginx -s reload
打开页面调试工具
protocol显示h2 即为开启成功