Nginx添加Lua扩展

环境

系统: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/
    
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容