參考:http://jinnianshilongnian.iteye.com/blog/2186270 #安裝環境nginx
源碼包存放目錄git
mkdir /home/opt
選擇使用openrest集成安裝環境github
cd /home/opt wget https://openresty.org/download/ngx_openresty-1.9.7.1.tar.gz tar zxf ngx_openresty-1.9.7.1.tar.gz cd ngx_openresty-1.9.7.1
##3. 安裝依賴包緩存
yum install pcre-devel pcre-devel pcre
cd bundle/LuaJIT-2.1-20151219/ make clean && make && make install
cd /home/opt/ngx_openresty-1.9.7.1/bundle wget https://github.com/FRiCKLE/ngx_cache_purge/archive/2.3.tar.gz tar -xvf 2.3.tar.gz
wget https://codeload.github.com/yaoweibin/nginx_upstream_check_module/zip/master unzip master rm -f master
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/ -j2 make && make install
單獨編譯ngin時碰到找不到lualib問題的解決方法lua
export LUAJIT_LIB=/usr/local/lib export LUAJIT_INC=/usr/local/include/luajit-2.1