Install nginx Lua and nginxLua
-- Preparation (download)
LuaJIT-2.0.3.tar.gz
Ngx_devel_kit
Nginx_lua_module
Nginx-1.4.7
(1) install LuaJIT
Tar-zxvf LuaJIT-2.0.3.tar.gz
Cd LuaJIT-2.0.3
Make
Make install
Because it is installed in the default path, the lib and include of LuaJIT are all in the/usr/local directory.
Modify Environment Variables
Export LUAJIT_LIB =/usr/local/lib
Export LUAJIT_INC =/usr/local/include/luajit-2.0
(2) install Nginx
Cd nginx-1.4.7
. /Configure -- prefix =/usr/local/nginx -- with-http_stub_status_module -- with-http_ssl_module -- with-pcre =/usr/local/src/pcre-8.35 -- with-zlib =/usr/local/src/ zlib-1.2.8 -- add-module =/usr/local/src/ngx_devel_kit -- add-module =/usr/local/src/lua-nginx-module
Make
Make install
(3) test
/Usr/local/nginx/sbin/nginx-t
Error: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory
-- Add variable
Cat/etc/ld. so. conf
Include ld. so. conf. d/*. conf
Echo "/usr/local/lib">/etc/ld. so. conf
Ldconfig
(4) modify the nginx. conf configuration file
Add server:
Location/hello {
Default_type 'text/plain ';
Content_by_lua 'ngx. say ("Hello Lua! ")';
}
(5) access appears
Hello Lua!