openresty/nginx升级http2

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

从源码编译安装openrestynginx

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

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

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

nginx -s stop先中止nginxrest

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

不先中止nginx的话会出现 cp: 没法建立普通文件'./nginx': 文本文件忙

而后将listenhttp2配置上启动nginx应该就能够看到blog

图片描述

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

图片描述

相关文章
相关标签/搜索