How LUA compiles into Nginx
1, the first installation Lua-jit, online said can also download Lua, but Lua-jit efficiency is high, address: http://luajit.org/download.html
I'm under the 2.0.3 version.
After the decompression, the direct made && make install on it, the default installation in the/usr/local directory
2, download NGX devel package
Address: Https://github.com/simpl/ngx_devel_kit/tags
Note that this is a nginx extension that does not require compilation
3, download the LUA extension of Nginx
Https://github.com/openresty/lua-nginx-module/archive/v0.9.8.tar.gz
4, export two variables
Copy Code code as follows:
Export Luajit_lib=/usr/local/lib
Export luajit_inc=/usr/local/include/luajit-<version>
Where Luajit represents the Luajit installation directory
5, the next is compiled Nginx
Copy Code code as follows:
./configure--PREFIX=/OPT/NGINXRW--with-http_gzip_static_module--with-http_stub_status_module
--with-http_ssl_module--add-module=/data/src/lua-nginx-module-0.9.8
--add-module=/data/src/ngx_devel_kit-0.2.19
Two of these--add-module represent Lua's nginx modules and NGX devel package extensions
At startup, the path to a library may not be found:
Copy Code code as follows:
Sbin/nginx:error while loading shared libraries:libluajit-5.1.so.2:cannot open Shared object file:no such file or dire Ctory
Use the LDD command to look at a dynamic library of references to a binary file
Solution:
Copy Code code as follows:
echo "/usr/local/lib" >>/etc/ld.so.conf.d/usr_local_lib.conf
Ldconfig
OK, is the compilation successful, start writing LUA scripts