Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not use resty redis #61

Open
logan2013 opened this issue Mar 24, 2021 · 1 comment
Open

can not use resty redis #61

logan2013 opened this issue Mar 24, 2021 · 1 comment

Comments

@logan2013
Copy link

logan2013 commented Mar 24, 2021

when i try to connect to the ws server(ws://ip:8081/ws), it raise error

2021/03/25 00:20:34 [info] 16392#16392: *1 client 113.92.35.59 closed keepalive connection

my nginx.conf content

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
                        }
        }

    }
}
@logan2013
Copy link
Author

@agentzh please help, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant