openresty/nginx升级http2

http2需要https支持,假设你已经有https证书

从源码编译安装openresty

解压:
tar -xzvf openresty-VERSION.tar.gz
cd openresty-VERSION/
三连:
./configure
make
sudo make install

此时安装的openresty配置http2会报错 the "http2" parameter requires ngx_http_v2_module

重新编译:./configure --with-http_v2_module
编译完成后make (不要make insall ,会覆盖安装)
编译出的nginx在 openresty-1.13.6.2/build/nginx-1.13.6/objs/
我们之拥替换此二进制文件就好了

nginx -s stop先停止nginx

openresty-1.13.6.2/build/nginx-1.13.6/objs/nginx 复制到/usr/local/openresty/nginx/sbin

不先停止nginx的话会出现 cp: 无法创建普通文件'./nginx': 文本文件忙

然后将listenhttp2配置上启动nginx应该就可以看到

openresty/nginx升级http2

如果替换了新编译的nginx二进制文件还是使用http1.1,检查一下openssl版本和编译的模块,openssl版本需大于1.0.1才能支持http2

openresty/nginx升级http2

相关推荐