nginx1.7 添加lua
来源:互联网 发布:淘宝巴黎心店卖假货 编辑:程序博客网 时间:2024/05/05 16:46
nginx1.7 添加lua
1:下载ngx_devel_kit.tar.gz 解压
2:下载nginx_lua_module.tar.gz 解压
3:# cd 到nginx的安装模块 后面跟的--add-module 即ngx_devel_kit和nginx_lua_module 解压路径
//注: 这里的openssh 和 pcre 也要下载解压(安装ngxin已经说了)
./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx.pid --with-openssl=/home/guotonglin/nginx/openssh-6.0p1 --with-pcre=/home/guotonglin/nginx/pcre-8.35 --with-http_stub_status_module --add-module=/home/guotonglin/nginx/lua-nginx-module-0.9.12rc2 --add-module=/home/guotonglin/nginx/ngx_devel_kit-0.2.19
4:执行make 和make install 命令
5:我这里是要实现监听反向代理服务器的返回内容:
具体的nginx.conf 配置:
//添加到http 和server之间
log_format main '$resp_body - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; // 这里是日志要显示的格式,我自己添加了 $resp_body(因为我要拿服务器返回的数据)
// server 和location 之间
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
local resp_body = string.sub(ngx.arg[1], 1, 1000)
ngx.ctx.buffered = (ngx.ctx.buffered or "") .. resp_body
if ngx.arg[2] then
ngx.var.resp_body = ngx.ctx.buffered
end
';
启动nginx会报 如下错误 (复制来的)
./sbin/nginx: error while loading shared libraries:libluajit-5.1.so.2: cannot open shared object file: No such file or directory
此类问题通常使用ldconfig命令就能解决:
echo "/usr/local/lib" >/etc/ld.so.conf.d/usr_local_lib.conf
ldconfig
重启nginx
1:下载ngx_devel_kit.tar.gz 解压
2:下载nginx_lua_module.tar.gz 解压
3:# cd 到nginx的安装模块 后面跟的--add-module 即ngx_devel_kit和nginx_lua_module 解压路径
//注: 这里的openssh 和 pcre 也要下载解压(安装ngxin已经说了)
./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx.pid --with-openssl=/home/guotonglin/nginx/openssh-6.0p1 --with-pcre=/home/guotonglin/nginx/pcre-8.35 --with-http_stub_status_module --add-module=/home/guotonglin/nginx/lua-nginx-module-0.9.12rc2 --add-module=/home/guotonglin/nginx/ngx_devel_kit-0.2.19
4:执行make 和make install 命令
5:我这里是要实现监听反向代理服务器的返回内容:
具体的nginx.conf 配置:
//添加到http 和server之间
log_format main '$resp_body - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; // 这里是日志要显示的格式,我自己添加了 $resp_body(因为我要拿服务器返回的数据)
// server 和location 之间
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
local resp_body = string.sub(ngx.arg[1], 1, 1000)
ngx.ctx.buffered = (ngx.ctx.buffered or "") .. resp_body
if ngx.arg[2] then
ngx.var.resp_body = ngx.ctx.buffered
end
';
启动nginx会报 如下错误 (复制来的)
./sbin/nginx: error while loading shared libraries:libluajit-5.1.so.2: cannot open shared object file: No such file or directory
此类问题通常使用ldconfig命令就能解决:
echo "/usr/local/lib" >/etc/ld.so.conf.d/usr_local_lib.conf
ldconfig
重启nginx
0 0
- nginx1.7 添加lua
- nginx1.4.6调用lua
- nginx1
- nginx1
- LNMP centos6.7+nginx1.9.12+mysql5.7.11+php5.6.13+PHP各项扩展安装 以及openresty nginx+lua环境
- Ubuntu14 + nginx1.7 源码安装
- vs2010中添加lua
- cocos2dx lua 添加动画
- Notepad++ 添加lua Functionlist
- lua添加面向对象
- CentOS 7下编译安装 nginx1.9.14
- CentOS 7下编译安装 nginx1.9.14
- CentOS 7编译安装Nginx1.9.0
- cocos2d-x(十二)Lua开发飞机大战-7-添加敌机
- cocos-Lua添加骨骼动画
- cocos2d-lua 添加lfs模块
- nginx新添加lua模块
- centos 7 min 编译安装php5.6+nginx1.7.5 笔记
- 最大域名服务商DNSPod将亮相中国互联网大会
- 酷酷的前端MVC框架AngularJS(一)简介
- HDU 1018 Big Number
- 铁路巡检管理系统
- Linux下Nginx+Tomcat整合的安装与配置
- nginx1.7 添加lua
- JAVA并行异步编程线程池+FutureTask
- ios-通过NSCalendar来获取当前时间的年、月、日、时、分、秒
- 基于linux的OLED移植过程
- SQL字符串基本操作小集
- java——GUI
- JMX经验点滴
- 提升HBase写性能
- java多线程(二)线程的互斥