需要使用openresty,还需要加入几个用得到nginx
module,又不想手工去编译,还好openresty提供了rpm的SPEC,稍改一下就OK,流水账一下。
1.安装openresty的repo
]# vi /etc/yum.repos.d/openresty.repo
[openresty]
name=Official OpenResty Open Source Repository for
CentOS
baseurl=https://openresty.org/package/centos/$releasever/$basearch
skip_if_unavailable=False
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://openresty.org/package/pubkey.gpg
enabled=1
]# yum install systemtap-sdt-devel openresty-zlib-devel
openresty-openssl-devel openresty-pcre-devel gcc
2.新增编译专用账号
]# useradd mockbuild
]# su - mockbuild
3.创建rpmbuild目录结构
]$ mkdir -p rpmbuild/{SPECS,BUILD,SRPMS,RPMS,SOURCES}
4.下载openresty打包配置文件
]$ git clone
https://github.com/openresty/openresty-packaging.git
]$ cp openresty-packaging/rpm/SOURCES/* rpmbuild/SOURCES
]$ cp openresty-packaging/rpm/SPECS/* rpmbuild/SPECS
5.下载openresty源码
]$ wget
https://openresty.org/download/openresty-1.13.6.1.tar.gz
]$ mv openresty-1.13.6.1.tar.gz rpmbuild/SOURCES/
6.下载ngx_dynamic_upstream模块源码
]$ git clone
https://github.com/cubicdaiya/ngx_dynamic_upstream.git
7.编辑openresty.spec文件,加入ngx_dynamic_upstream模块
]$ vi rpmbuild/SPECS/openresty.spec
......
--with-dtrace-probes \
=====>
--add-module=/home/mockbuild/ngx_dynamic_upstream
\
%{?_smp_mflags}
......
8.使用rpmbuild命令打包即可。
]$ rpmbuild -bb openresty.spec