nginx增加lua模块 yum install -y gcc g++ gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel wget -c http://luajit.org/download/LuaJIT-2.0.4.tar.gz tar xzvf LuaJIT-2.0.4.tar.gz cd LuaJIT-2.0.4 make install PREFIX=/usr/local/luajit # 添加环境变量 export LUAJIT_LIB=/usr/local/luajit/lib export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0 ln -s /usr/local/luajit/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2 #不增加这行,nginx启动会报错 mkdir -p /opt/modules wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz tar -xzvf v0.3.0.tar.gz cd /opt/modules wget https://github.com/openresty/lua-nginx-module/archive/v0.10.8.tar.gz tar -xzvf v0.10.8.tar.gz cd /opt/modules wget http://nginx.org/download/nginx-1.10.3.tar.gz tar -xzvf nginx-1.10.3.tar.gz cd nginx-1.10.3 ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-cc-opt=-O3 --with-stream --add-module=/opt/modules/ngx_devel_kit-0.3.0 --add-module=/opt/modules/lua-nginx-module-0.10.8 make make install