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’: 文本文件忙
然后将listen的http2配置上启动nginx应该就可以看到

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

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理