下载安装文件
#wget http://luajit.org/download/LuaJIT-2.0.3.tar.gz
#git clone https://github.com/simpl/ngx_devel_kit.git
#git clone https://github.com/chaoslawful/lua-nginx-module.git
#git clone https://github.com/agentzh/echo-nginx-module.git
安装LuaJIT
#tar -zxf LuaJIT-2.0.3.tar.gz
#make
#make install
环境配置
#export LUAJIT_LIB=/usr/local/lib
#export LUAJIT_INC=/usr/local/include/luajit-2.0
#export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
安装nginx模块
#./configure \
--with-http_ssl_module \
--prefix=/usr/local/nginx \
--add-module=/root/my/git/ngx_devel_kit \
--add-module=/root/my/git/lua-nginx-module \
--add-module=/root/my/git/echo-nginx-module
#make
#cp objs/nginx /usr/local/nginx/sbin/nginx
测试lua
#vi /usr/local/nginx/conf/nginx.conf
location ~* ^/hello_lua(/.*) {
default_type 'text/plain';
content_by_lua 'ngx.say("hello, lua!")';
}
#curl http://localhost/hello_lua/
hello, lua!
最新评论