前提
已安装完成Nginx
安装LuaJIT
wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz
tar -zxvf LuaJIT-2.0.5.tar.gz
cd LuaJIT-2.0.5
make install PREFIX=/usr/local/LuaJIT
echo "export LUAJIT_LIB=/usr/local/LuaJIT/lib" >> /etc/profile
echo "export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0" >> /etc/profile
source /etc/profile
安装ngx_devel_kit
cd /opt/
wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.0.tar.gz
tar zxvf v0.3.0.tar.gz
安装lua-nginx-module
cd /opt/
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.13.tar.gz
tar zxvf v0.10.13.tar.gz
重新编译Nginx
yum install lua-devel readline-devel pcre-devel openssl-devel -y
cd nginx
./auto/configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-pcre --with-ld-opt=-Wl,-rpath,/usr/local/LuaJIT/lib --add-module=/opt/ngx_devel_kit-0.3.0 --add-module=/opt/lua-nginx-module-0.10.13 &&
make && make install
测试lua-nginx-module
vim /usr/local/nginx/conf/nginx.conf
location /hello {
default_type 'text/plain';
return 200 'hello echo!';
}
location /hello_lua {
default_type 'text/plain';
content_by_lua 'ngx.say("hello, lua!")';
}
/usr/local/nginx/sbin/nginx
参考资料
https://www.cnblogs.com/52fhy/p/10164553.html
标签:LuaJIT,tar,nginx,--,lua,module,Nginx,模块 From: https://www.cnblogs.com/WJQ2017/p/17778038.html