我正在尝试使用 init_by_lua 指令:https ://github.com/chaoslawful/lua-nginx-module#init_by_lua
并且 nginx 无法启动,日志中有此消息:
2014/04/08 17:33:53 [emerg] 2105#0: "init_by_lua" directive is not allowed here in /genap/genap-nginx.conf:6
nginx conf文件是:
worker_processes 1;
error_log logs/error.log;
init_by_lua 'local zaz = 4321';
events {
worker_connections 1024;
}
http {
server {
lua_code_cache off;
listen 80;
location / {
default_type text/html;
content_by_lua_file /vagrant/genap_host_proxy/content.lua;
}
}
}
我尝试将 init_by_lua 放在 http 和 server 块中,但我得到了相同的错误 init_by_lua