openresty/nginx升级http2

10次阅读

共计 587 个字符,预计需要花费 2 分钟才能阅读完成。

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

正文完
 0