Install nginx Lua and nginxLua

Source: Internet
Author: User

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!

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.