worker_processes 4;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
lua_package_path "/app/lua/?.lua;/usr/local/openresty/lualib/resty/?.lua;;";
lua_code_cache off;
server {
listen 6699;
charset utf-8;
#lua_need_request_body on;
location ~ ^/api/([-_a-zA-Z0-9/]+) {
#echo $remote_addr;
default_type application/json;
access_by_lua_file lua/bootstrap.lua;
content_by_lua_file lua/.lua;
}
}
}
ngx.var in the lua script is an empty table
It is true that it cannot be printed, but it can be done individually, such as ngx.var.remote_addr, ngx.var.args (if the uri has parameters). Please give an expert answer as to why it cannot be printed. http://www.cnblogs.com/raiche ... These all seem to be OK
I think the method of printing ngx.var is wrong. ngx.var is a table and a function needs to be implemented to print the table.
Reference
https://gist.github.com/range...