環(huán)境
系統(tǒng):CentOS 7.5
準(zhǔn)備
編譯安裝LuaJIT
-
編譯安裝
# tar -xzvf LuaJIT-2.0.5.tar.gz # cd LuaJIT-2.0.5 # make # make install
下載ngx_devel_kit
-
解壓
# tar -xzvf ngx_devel_kit-0.3.0.tar.gz
下載lua-nginx-module
下載
地址:https://github.com/openresty/lua-nginx-module/releases-
解壓
# tar -xzvf lua-nginx-module-0.10.13.tar.gz
重新編譯安裝Nginx
-
查看原來(lái)編譯參數(shù)
# nginx -V ...... configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-stream
-
添加Lua擴(kuò)展冈敛,重新編譯安裝
# 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
其它
-
問(wèn)題
# 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/