nginx 安裝 lua-nginx-module
需要LuaJIT-2.0.4.tar.gz,ngx_devel_kit,lua-nginx-module
1.下載安裝LuaJIT-2.0.5.tar.gz
http://luajit.org/download.html
wget -c http://luajit.org/download/LuaJIT-2.0.5.tar.gz
tar xzvf LuaJIT-2.0.5.tar.gz
cd LuaJIT-2.0.5
make install PREFIX=/usr/local/luajit
#注意環境變數!
vim /etc/profile
export LUAJIT_LIB=/usr/local/luajit/lib
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0
#####export LD_LIBRARY_PATH=/usr/local/luajit/lib:$LD_LIBRARY_PATH
source /etc/profile
2.下載解壓ngx_devel_kit
下載頁面 https://github.com/simplresty/ngx_devel_kit
wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.0.tar.gz
tar -xzvf v0.3.0.tar.gz
mv /data/apps/ngx_devel_kit-0.3.0 /opt/soft/ngx_devel_kit-0.3.0
3.下載解壓lua-nginx-module
下載頁面 https://github.com/openresty/lua-nginx-module
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.13.tar.gz
tar -xzvf v0.10.13.tar.gz
mv /data/apps/lua-nginx-module-0.10.13 /opt/soft/lua-nginx-module-0.10.13
4.下載安裝nginx-1.10.3.tar.gz
cd /data/apps
wget http://nginx.org/download/nginx-1.14.1.tar.gz
tar -zxvf nginx-1.14.1.tar.gz
cd nginx-1.14.1
先configure指定編譯選項,如安裝目錄、上面建立的執行使用者、需要的擴充套件模組(SSL、FastCGI)等,選項及引數說明:http://nginx.org/en/docs/configure.html,操作如下:
[[email protected] nginx]# ./configure \ --prefix=/usr \ --sbin-path=/usr/sbin/nginx \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --user=nginx \ --group=nginx \ --with-http_ssl_module \ --with-http_flv_module \ --with-http_stub_status_module \ --with-http_gzip_static_module \ --http-client-body-temp-path=/var/tmp/nginx/client/ \ --http-proxy-temp-path=/var/tmp/nginx/proxy/ \ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \ --http-scgi-temp-path=/var/tmp/nginx/scgi \ --with-pcre \ --add-module=/opt/soft/nginx-module-vts-master \ --add-module=/opt/soft/ngx_devel_kit-0.3.0 \ --add-module=/opt/soft/lua-nginx-module-0.10.13
Configure成功如下:
之後進行安裝
make && make install
service nginx restart
備註:
報錯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/luajit/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2
具體source的路徑已實際安裝路徑為準