这篇文章主要综合了网上CentOS 平台下Nginx 编译安装并开启lua 支持的教程.

平台及版本

OS: CentOS 7
Nginx: Nginx-1.14

第三方依赖及库

  1. 依赖安装 bash yum install -y pcre pcre-devel openssl openssl-devel zlib zlib-devel
  2. 相关下载 pcre
    LuaJit
    ngx_dev_kit
    lua-nginx-module
  3. LuaJit 编译安装 bash make PREFIX=/usr/local/luajit make install PREFIX=/usr/local/luajit export LUAJIT_LIB=/usr/local/luajit/lib export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0

编译安装

./configure --prefix=/opt/nginx \
    --with-pcre=/nginx_moudle/pcre-8.41 \
    --with-luajit \
    --without-http_redis2_module \
    --with-http_iconv_module \
    --add-module=/nginx_moudle/ngx_devel_kit-0.3.0/ \ 
    --add-module=/nginx_moudle/lua-nginx-module-0.10.10/

make && make install