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,操作如下:

[root@node2 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的路径已实际安装路径为准

 

posted @ 2018-11-14 17:12  史红星-shihongxing  阅读(794)  评论(0编辑  收藏  举报