本文共 3156 字,大约阅读时间需要 10 分钟。
lua安装wget http://www.lua.org/ftp/lua-5.3.5.tar.gztar -xf lua-5.3.5.tar.gzcd lua-5.3.4/make linux testmake install
wget http://luajit.org/download/LuaJIT-2.0.5.tar.gztar -xf LuaJIT-2.0.5.tar.gzcd LuaJIT-2.0.5/makemake install PREFIX=/usr/local/LuaJITNDK(nginx development kit)模块是一个拓展nginx服务器核心功能的模块,第三方模块开发可以基于它来快速实现。 NDK提供函数和宏处理一些基本任务,减轻第三方模块开发的代码量。
wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.1.tar.gzwget https://github.com/openresty/lua-nginx-module/archive/v0.10.15.tar.gzcd /usr/local/nginx/moduletar -xf v0.3.1.tar.gztar -xf v0.10.15.tar.gz
添加设置luaJit的环境变量(如果这一步设置错误会报错:/configure: error: ngx_http_lua_module requires the Lua library.)
export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0 #路径是上面luajit实际安装路径,路径错误安装lua模块时会报错很早不到luajit库export LUAJIT_LIB=/usr/local/LuaJIT/lib
预编译: 通过nginx -V获取之前预编译参数,并增加 --add-module参数
yum -y install lua-develcd /root/nginx-1.8.1./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-threads --user=www --group=www --add-module=/usr/local/nginx/module/echo-nginx-module-0.61 --add-module=/usr/local/nginx/module/lua-ssl-nginx-module-0.01rc3 --add-module=/usr/local/nginx/module/xss-nginx-module-0.06 --add-module=/usr/local/nginx/module/nginx-eval-module-2016.06.10 --add-module=/usr/local/nginx/module/ngx_devel_kit-0.3.1 --add-module=/usr/local/nginx/module/lua-nginx-module-0.10.15
# 编译器./configure > --prefix=/usr/local/nginx > --with-http_ssl_module > --with-http_realip_module > --with-http_addition_module > --with-http_sub_module > --with-http_dav_module > --with-http_flv_module > --with-http_mp4_module > --with-http_gunzip_module > --with-http_gzip_static_module > --with-http_auth_request_module > --with-http_random_index_module > --with-http_secure_link_module > --with-http_degradation_module > --with-http_stub_status_module > --with-mail --with-mail_ssl_module > --with-threads > --user=www > --group=www > --add-module=/usr/local/nginx/module/echo-nginx-module-0.61 > --add-module=/usr/local/nginx/module/lua-ssl-nginx-module-0.01rc3 > --add-module=/usr/local/nginx/module/xss-nginx-module-0.06 > --add-module=/usr/local/nginx/module/nginx-eval-module-2016.06.10 > --add-module=/usr/local/nginx/module/ngx_devel_kit-0.3.1 > --add-module=/usr/local/nginx/module/lua-nginx-module-0.10.15
make && make install
cd objs/cp /usr/local/nginx/sbin/nginx /usr/local/sbin/nginx.bakcp nginx /usr/local/nginx/sbin/nginx
vim /etc/ld.so.conf.d/usr_local_lib.conf/usr/loca/lib/usr/local/LuaJIT/libldconfigvim /usr/local/nginx/conf/nginx.confhttp{ ... lua_package_cpath '/usr/local/LuaJIT/lib/lua/5.1/?.so;;'; lua_package_path '/usr/local/LuaJIT/share/luajit-2.0.5/resty/?.lua;;'; ... server{ ... }}
nginx -s reloadnginx -V
转载地址:http://nmnwi.baihongyu.com/