歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

LNMP平滑升級&重編譯安裝ngx_lua module模塊

#ngx_lua module項目地址 https://github.com/chaoslawful/lua-nginx-module 在LNMP安裝包後,重編譯nginx,並添加ngx_lua模塊 1」Download wget http://luajit.org/download/LuaJIT-2.0.2.tar.gz wget https://github.com/simpl/ngx_devel_kit/archive/v0.2.19.tar.gz wget https://github.com/chaoslawful/lua-nginx-module/archive/v0.9.1.tar.gz nginx最新穩定版是1.4.3,get下來 wget http://nginx.org/download/nginx-1.4.3.tar.gz 2」安裝LuaJIT tar -zxvf LuaJIT-2.0.2.tar.gz cd LuaJIT-2.0.2 make make install export LUAJIT_LIB=/usr/local/lib export LUAJIT_INC=/usr/local/include/luajit-2.0 3」copy模塊  解壓下載下來的ngx_devel_kit以及lua-nginx-module到/usr/local/src目錄下,即 /usr/local/src/lua-nginx-module-0.9.1/  /usr/local/src/ngx_devel_kit-0.2.19/  3」重新編譯Nginx 解壓nginx包,configure一下(參考LNMP安裝包,未加其他修改) ./configure --user=www --group=www --prefix=/usr/local/nginx --with-ld-opt="-Wl,-rpath,$LUAJIT_LIB" --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 \ --add-module=/usr/local/src/lua-nginx-module-0.9.1/ \ --add-module=/usr/local/src/ngx_devel_kit-0.2.19/ OK後make,別make install,否則就覆蓋安裝 4」備份替換 make完後在objs目錄下多了個nginx,即新版本的程序  備份舊的nginx程序 cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak 新nginx程序覆蓋舊的 cp objs/nginx /usr/local/nginx/sbin/nginx 測試新的nginx程序是否正確 /usr/local/nginx/sbin/nginx -t nginx: theconfiguration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx:configuration file /usr/local/nginx/conf/nginx.conf test issuccessful 平滑重啟nginx /usr/local/nginx/sbin/nginx -s reload 查看ngixn版本及其編譯參數 /usr/local/nginx/sbin/nginx -V 「問題解決」 1.如遇到找不到庫文件 echo “/usr/local/lib” > /etc/ld.so.conf.d/usr_local_lib.conf ldconfig 即可 2./usr/local/nginx/sbin/nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory   在 Nginx 編譯時,需要指定 RPATH,記得加入下面選項: ./configure --with-ld-opt="-Wl,-rpath,$LUAJIT_LIB"   或者export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH   Referer:   http://www.2cto.com/os/201311/259514.html
 http://www.2cto.com/os/201311/259515.html  http://www.2cto.com/os/201311/259516.html
Copyright © Linux教程網 All Rights Reserved