美文网首页
Nginx添加Lua扩展

Nginx添加Lua扩展

作者: 袁先生的笔记 | 来源:发表于2018-10-25 18:19 被阅读0次

    环境

    系统:CentOS 7.5

    准备

    编译安装LuaJIT

    下载ngx_devel_kit

    下载lua-nginx-module

    重新编译安装Nginx

    • 查看原来编译参数

      # nginx -V
      ......
      configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-stream
      
    • 添加Lua扩展,重新编译安装

      # export LUAJIT_LIB=/usr/local/lib
      # export LUAJIT_INC=/usr/local/include/luajit-2.0
      
      # cd nginx-1.12.1/
      # ./configure \
      --prefix=/usr/local/nginx \
      --with-http_ssl_module \
      --with-http_stub_status_module \
      --with-stream \
      --add-module=/usr/local/src/ngx_devel_kit-0.3.0 \
      --add-module=/usr/local/src/lua-nginx-module-0.10.13
      
      # make
      # make install
      
    • 重启

      # nginx -t
      # systemctl restart nginx
      

    其它

    • 问题

      # nginx -t
      nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory
      

      解决办法

      # ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/
      

    相关文章

      网友评论

          本文标题:Nginx添加Lua扩展

          本文链接:https://www.haomeiwen.com/subject/haectqtx.html