I am very new to nginx and lua .i have installed Openresty .
below is my code in nginx.conf file .
server{ location /hellolua { default_type 'text/plain'; content_by_lua ' local name = ngx.var.arg_name or "Anonymous" ngx.say("Hello, ", name, "!") '; } }
When i am running
sudo service nginx start
i am getting error
Starting nginx: nginx: [emerg] unknown directive "content_by_lua" in /etc/nginx/nginx.conf:24 nginx: configuration file /etc/nginx/nginx.conf test failedt
Please let me know what i am missing .
Best Answer
It seems to me, as if you haven't installed the right module? ngx_lua (http://wiki.nginx.org/HttpLuaModule)
You mention OpenResty. Did you configure it with lua? If not, the guide is here(http://wiki.nginx.org/HttpLuaModule#Installation).
Quick resumé:
You can manually compile ngx_lua into nginx too, the full guide is in the link too.
After comment-discussing - I removed the irrelevant part of the answer.