nginx.conf中是这样写的:
location /test2 {
content_by_lua '
local file = io.open("123.txt","w")
file:write("456")
file:close()
';
}
错误日志:
2012/09/12 16:19:38 [error] 7398#0: *1 lua handler aborted: runtime error: [string "content_by_lua"]:3: attempt to index local 'file' (a nil value)
stack traceback:
coroutine 0:
[string "content_by_lua"]: in function <[string "content_by_lua"]:1>, client: 111.4.115.115, server: , request: "GET /test2/ HTTP/1.1", host: "111.4.115.106:17080", referrer: "http://111.4.115.106:17080/test2"