using Luajit ?

166 views
Skip to first unread message

alain meunier

unread,
Mar 19, 2013, 7:42:52 AM3/19/13
to openre...@googlegroups.com
Hi,

I am not sure how to use the luajit2.0 module with nginx.

I read http://wiki.nginx.org/HttpLuaModule#Lua.2FLuaJIT_bytecode_support

But i don't fully understand : how may I be sure to use luajit ?
My version came from the last official debian packaged one, which contains your lua module.

That is why I ask here.

May you enlighten me please ?

Cheers,

Alain

Brian Akins

unread,
Mar 19, 2013, 3:14:21 PM3/19/13
to openre...@googlegroups.com
It's easiest to grab the openresty bundle and build from it, IMO.

agentzh

unread,
Mar 19, 2013, 3:29:45 PM3/19/13
to openre...@googlegroups.com
Hello!

On Tue, Mar 19, 2013 at 4:42 AM, alain meunier wrote:
> I am not sure how to use the luajit2.0 module with nginx.
>
> I read http://wiki.nginx.org/HttpLuaModule#Lua.2FLuaJIT_bytecode_support
>
> But i don't fully understand : how may I be sure to use luajit ?
> My version came from the last official debian packaged one, which contains
> your lua module.
>

If the Debian package uses the standard Lua 5.1 interpreter already
(I'm not sure), then you're recommended to recompile nginx and ngx_lua
from source. The easiest way is to use the ngx_openresty bundle, as
Brian suggested:

http://openresty.org/#Download

Just build it like this on Linux:

./configure --with-luajit -j4
make -j4
make install
/usr/local/openresty/nginx/sbin/nginx -V

where we assume that you have 4 CPU cores available.

When you have troubles, just refer to the installation documentation
of openresty:

http://openresty.org/#Installation

Best regards,
-agentzh

avi...@adallom.com

unread,
Mar 21, 2013, 8:41:40 AM3/21/13
to openre...@googlegroups.com, dec...@hotmail.fr
I think it's easier to install the lua module without openresty.
Simply install LuaJIT, then download the nginx source, nginx development kit and lua nginx source, then use the following script (replace the path where needed) instead of configure, then make and then make install (as root):

#!/usr/bin/env bash

# Add options required for a 'real' installation (from package).
# Note that the main directory of nginx will be set to the default - /usr/local/nginx.
INSTALLATION_OPTIONS="--sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log"

# Add Lua options for the Lua Module (see http://wiki.nginx.org/HttpLuaModule#Installation ).
# Note that we use the recommended LuaJIT, and not Lua 5.1/2.
export LUAJIT_LIB=/usr/lib/x86_64-linux-gnu/libluajit-5.1.so              # Default path when installing from package
export LUAJIT_INC=/usr/include/luajit-2.0                                        # Default path when installing from package

./configure --add-module=<nginx-development-kit-path> --add-module=<lua-nginx-module-path> --with-cc=gcc $INSTALLATION_OPTIONS $*
Reply all
Reply to author
Forward
0 new messages