How to check if nginx uses LuaJit and not Lua?

戏子无情 提交于 2019-12-04 22:47:04

Edit your nginx.conf file, add a location into your server {} block:

location = /lua {
    default_type text/plain;
    content_by_lua '
        if jit then
            ngx.say(jit.version)
        else
            ngx.say("Not LuaJIT!")
        end
    ';
}

Then start your nginx server and then access /lua in curl or in your favorite web browser. If you see outputs like "LuaJIT 2.0.2", then you're using LuaJIT; otherwise, if you see "Not LuaJIT!", then you're using the standard Lua 5.1 interpreter.

Another quicker way is to check the Lua DSO file linked with your nginx executable if dynamic linking is used (which is usually the case):

ldd /path/to/your/nginx/sbin/nginx|grep -i lua

If you see something like

libluajit-5.1.so.2 => /usr/local/openresty-debug/luajit/lib/libluajit-5.1.so.2 (0x00007fb3d38f6000)

Then you're using LuaJIT.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!