Compiling Lua into the Nginx step method _lua

Source: Internet
Author: User
Tags lua

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.