首先说明下我的环境和版本
nginx版本:nginx/1.4.1
ngx_lua版本:0.2.0
用到luajit环境
http虚拟主机的配置段
location ~* ^/loginx {
access_by_lua '
local sock, err = ngx.req.socket()
if not sock then
ngx.log(ngx.ERR, "failed to get the request socket: ", err)
end
local data, err, partial = sock:receive(4029)
ngx.say(partial)
';
}
上述代码可以正常运行
当不存在location段(也就是代码去掉红色部分,直接放置到http或者server部分时),执行会卡半天,不知道是什么原因?