wget https://openresty.org/download/openresty-1.15.8.1.tar.gz
tar zxvf openresty-1.15.8.1.tar.gz
cd openresty-1.15.8.1
# 查看当前nginx的编译配置
nginx -V
如下所示, configure arguments 就是当前nginx的配置
nginx version: nginx/1.7.4
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
TLS SNI support enabled
configure arguments: --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module
# HTTP2只能运行在https环境
./configure --prefix=/usr/local/openresty/nginx --with-http_ssl_module --with-http_v2_module
gmake && gmake install
# 如果有ssl证书,记得也一起过去
cp /usr/local/nginx/conf/*.conf /usr/local/openresty/conf
# nginx.conf 记得加上
listen 443 ssl http2;
nginx -s stop
/usr/local/openresty/nginx/bin/openresty
ln -s /usr/local/openresty/nginx/bin/openresty /usr/local/bin/nginx
# 以后就可以直接使用nginx的相关操作命令了
nginx
©2018-2020 hongshali.com 版权所有 ICP证:闽ICP备18029655号-1