Hello!
2015-01-22 23:28 GMT-08:00 陈立强:
> 我可以怎么配置一个location就可以保证:/lua/{var}的访问,会自动content_by_lua_file
> /home/httpd/html/hits/trunk/{var}.lua
>
引用一下 ngx_lua 官方文档中的一个示例:
# WARNING: contents in nginx var must be carefully filtered,
# otherwise there'll be great security risk!
location ~ ^/app/([-_a-zA-Z0-9/]+) {
set $path $1;
content_by_lua_file /path/to/lua/app/root/$path.lua;
}
当然,使用自定义的 Lua module 也是动态代码加载的一种做法。
Regards,
-agentzh