1、 安装建议下载openresty ,包比较全,安装简单方便;
下载地址 http://openresty.org/download/ngx_openresty-1.7.10.1.tar.gz
2、编译安装
tar xzvf ngx_openresty-1.7.10.1.tar.gz cd ngx_openresty-1.7.10.1 ./configure --with-luajit make make install3、修改nginx config - /usr/local/openresty/nginx/conf/nginx.conf
# http段内添加下面引入redis支持:
lua_package_path "/home/ngx_openresty-1.7.10.1/bundle/lua-resty-redis-0.20/lib/resty/?.lua;;";
#关闭lua脚本缓存,使得每次调用加载脚本,脚本修改不需要重启nginx
lua_code_cache off;
4. nginx lua脚本使用方法
config文件内执行脚本
#lua script excute in this config
location