worker_processes 2;
user root;
events {
worker_connections 1024;
}
error_log logs/error.log debug;
http {
server {
listen 8081 reuseport;
location /ws {
access_by_lua_block {
local ngx = ngx
local redis = require("resty.redis")
ngx.log(ngx.INFO, "access stage")
local red = redis:new()
local ok, err = red:connect("127.0.0.1", 6379)
if not ok then
ngx.exit(ngx.HTTP_UNAUTHORIZED)
end
}
}
}
}
when i try to connect to the ws server(ws://ip:8081/ws), it raise error
my nginx.conf content