- 修改完nginx配置之后,要运行
nginx -t
检查配置 - lua中的print以notice日志打印到error_log中,所以需要开启notice日志,
error_log /var/log/nginx/error.log notice;
参考: http://wiki.nginx.org/HttpLuaModuleZh#print - body_filter_by_lua可以用于修改响应, ngx.arg[1]为body正文,由于响应可能会分成多段,所以lua代码可能会触发多次,ngx.arg[2]为eof标记,当正文结束时,ngx.arg[2]为true
- 设置lua_code_cache off,可以禁用*_by_lua_file的lua缓存,编辑lua代码之后,不需要reload nginx即可生效,这个指令对于content_by_lua之类写在nginx配置文件内部的lua代码无效。
Last active
August 29, 2015 13:57
-
-
Save notsobad/9481689 to your computer and use it in GitHub Desktop.
By notsobad.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment