您的位置:首页 > 数据库 > Redis

window: Nginx+Lua+Redis 构建高并发应用

2016-08-09 00:00 375 查看
1.下载支持 Lua的Nginx---Openresty: https://openresty.org/download/openresty-1.9.15.1-win32.zip
2.nginx.conf设置Lua的文件目录

location /lua {
default_type text/plain;
#lua_code_cache on;
content_by_lua_file lua/demo.lua;
}

2.编写一个Redis脚本放到lua目录里:

local redis = require "resty.redis"
local client = redis.new()
client.connect(client, '127.0.0.1', '6379')//IP和端口
client.auth(client,'auth')//设置Redis密码
client:select(0)
local value = client:hget('List','abc')
ngx.redirect(value) //实现跳转

3.运行Nginx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Nginx Lua Redis