proxy_pass http://127.0.0.1;body_filter_by_lua 'ngx.arg[1] = os.execute("/usr/local/bin/node test.js")';
另外,在lua中使用io.popen调用外部命令会阻塞nginx进程,极大的影响nginx性能,不推荐这么做。推荐你用http协议让nginx和你的nodejs脚本通信。打孙使用nodejs的一个脚本来替换response的body,没有成功。ngx_lua应该如何调用外部的系统命令?
--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html