server{
lua_code_cache off; //关闭lua缓存 重启后生效
server_name localhost;
default_type 'text/plain';
content_by_lua_file /conf/lua/test.lua; //将lua程序用file文件加载
}默认情况下lua_code_cache 是开启的,即缓存lua代码,即每次lua代码变更必须reload nginx才生效,如果在开发阶段可以通过lua_code_cache off;关闭缓存,这样调试时每次修改lua代码不需要reload nginx;但是正式环境一定记得开启缓存。