我在nginx.conf 文件增加以下区块 在启动时报错
Segmentation fault (core dumped)
我在nginx.conf 文件增加以下区块 在启动时报错
stream {
lua_code_cache on;
server {
listen 6677;
content_by_lua_file /usr/local/openresty/site/log_server.lua;
error_log logs/log_error.log error;
}
}
/data/webserver/openresty/bin/openresty -p /data/www/aaa/ -c nginx.conf -t 当执行这一行时也报错
Segmentation fault (core dumped)
我的log_server.lua文件如下:
local producer = require "resty.kafka.producer"
local sock = assert(ngx.req.socket(true))
local cjson = require("cjson")
local config = require('lapis.config').get()
sock:settimeout(1000) -- one second timout
local data_info = sock:receive('*l')
--ngx.log(ngx.INFO, "服务端接收数据:", cjson.encode(config.kafka))
if config.kafka.is_write_kafka == 1 then
ngx.log(ngx.INFO, "服务端接收数据:", data_info)
local p = producer:new(config.kafka.broker_list)
local offset, err = p:send(config.kafka.topic, "", data_info)
if not offset then
ngx.log(ngx.ERR,"写入kafka失败",data_info, cjson.encode(err))
end
ngx.log(ngx.INFO,"写入kafka成功")
end