参考: #安装环境
1. 创建目录
源码包存放目录
mkdir /home/opt
2. 下载ngx_openresty-1.9.7.1.tar.gz并解压
选择使用openrest集成安装环境
cd /home/optwget https://openresty.org/download/ngx_openresty-1.9.7.1.tar.gztar zxf ngx_openresty-1.9.7.1.tar.gzcd ngx_openresty-1.9.7.1
##3. 安装依赖包
yum install pcre-devel pcre-devel pcre
4. 安装LuaJIT
cd bundle/LuaJIT-2.1-20151219/make clean && make && make install
5. 下载ngx_cache_purge模块,该模块用于清理nginx缓存
cd /home/opt/ngx_openresty-1.9.7.1/bundlewget https://github.com/FRiCKLE/ngx_cache_purge/archive/2.3.tar.gz tar -xvf 2.3.tar.gz
6. 下载nginx_upstream_check_module模块,该模块用于ustream健康检查
wget https://codeload.github.com/yaoweibin/nginx_upstream_check_module/zip/masterunzip masterrm -f master
7. 安装ngx_openresty
cd /home/opt/ngx_openresty-1.9.7.1./configure --with-http_realip_module --with-pcre --with-luajit --add-module=./bundle/ngx_cache_purge-2.3/ --add-module=./bundle/nginx_upstream_check_module-master/ -j2make && make install
单独编译ngin时碰到找不到lualib问题的解决方法
export LUAJIT_LIB=/usr/local/libexport LUAJIT_INC=/usr/local/include/luajit-2.1