Reputation: 10124
I'm trying to use the init_by_lua directive : https://github.com/chaoslawful/lua-nginx-module#init_by_lua
and nginx fails to start, with this message in the log :
2014/04/08 17:33:53 [emerg] 2105#0: "init_by_lua" directive is not allowed here in /genap/genap-nginx.conf:6
the nginx conf file is :
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;
}
}
}
I've tries putting init_by_lua in the http and server block, and I get the same error init_by_lua
Upvotes: 2
Views: 3038
Reputation: 19277
init_by_lua
is only allowed in http
content: http://wiki.nginx.org/HttpLuaModule#init_by_lua
http {
init_by_lua '
require "resty.core"
';
}
Upvotes: 3
Reputation: 973
Have you tried to put it inside the http { ... } block?
http {
init_by_lua 'local zaz = 4321';
server { ... }
}
Upvotes: 1