![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
lua
wangc_gogo
一个标点符号一篇博客,也是一种进步!!!
展开
-
lua 之http请求内部请求
# 1、内部请求单个(只能请求内部服务)```ngx.location.capture(uri,{options...});local res = ngx.location.capture("order",{ method = ngx.HTTP_GET, #设置请求方式为get请求 args = {orderId=1,userId=2}, # get请求参数 body = "orderId=1&userId=2" ...原创 2020-09-16 09:57:31 · 855 阅读 · 0 评论 -
lua + redis 实现动态ip黑名单
lua_shared_dict shared_ip_blacklist 1m; #定义ip_blacklist 本地缓存变量location /ipblacklist { access_by_lua_file /usr/local/lua/access_by_limit_ip.lua; echo "ipblacklist";}local function close_re...原创 2019-12-03 09:55:02 · 1087 阅读 · 0 评论 -
ngnix location 详解 last和break
root html;html/test/50.htmllast会重新发起请求,而break会直接查找资源具体见演示: location /break/ { rewrite ^/break/(.*) /test/$1 break; } location /last/ { rew...原创 2019-12-02 13:20:59 · 353 阅读 · 0 评论 -
lua openresty 阶段详解图
原创 2019-12-02 08:11:51 · 469 阅读 · 0 评论 -
nginx 执行的11个阶段
nginx代码执行的的顺序与执行阶段有关,与代码的实际顺序无关(在有阶段区分时)原创 2019-12-02 08:05:17 · 457 阅读 · 0 评论 -
nginx lua http 请求转发
转发:get请求 location /product { internal; echo "商品信息"; } location /order { content_by_lua_block{ local resp = ngx.locat...原创 2019-12-01 18:31:32 · 815 阅读 · 0 评论 -
lua redis 管道
local redis = require "resty.redis_iresty"local opts = { ip = "192.168.31.247", port = "6379", password = "123456", db_index = 1}local red = redis:new(opts)local red =redis:new(o...原创 2019-12-01 08:15:11 · 257 阅读 · 0 评论 -
redis lua 二次封装类库
local redis_c = require "resty.redis"local ok, new_tab = pcall(require, "table.new")if not ok or type(new_tab) ~= "function" then new_tab = function (narr, nrec) return {} endendlocal _M = n...原创 2019-12-01 08:10:13 · 391 阅读 · 0 评论 -
lua + redis 连接池设置
local function close_redis(red) if not red then return end local pool_max_idle_time =10000 local pool_size =100 local ok,err = red:set_keepalive(pool_max_idle_time,...原创 2019-12-01 07:37:20 · 2204 阅读 · 0 评论 -
opresty + lua +redis helloworld
--关闭连接local function close_redis(red) if not red then return end local ok,err =red:close() if not ok then ngx.say("close redis err :",err) endend-...原创 2019-12-01 07:02:32 · 174 阅读 · 0 评论 -
lua 函数编程
function init() return 1,2endlocal x,y=init()print(x.."----"..y)直接将值赋给x,ylua还支持函数作为参数传递:function functiontest(x,y) print(x.."------"..y)endfunction init(x,y,functiontest) ret...原创 2019-11-26 16:57:00 · 243 阅读 · 0 评论 -
lua 数据格式
原创 2019-11-25 17:00:21 · 815 阅读 · 0 评论 -
lua 对象添加方法
原创 2019-07-31 09:54:36 · 948 阅读 · 0 评论 -
lua获取参数的方式
--只获取参数:local args= ngx.var.args 无法通过args["属性获取值"]或 ngx.req.get_uri_args() 可以通过属性获取值-- 这个变量等于包含一些客户端请求参数的原始URI(包含uri和参数)local request_uri = ngx.var.request_uri-- 请求中的当前URI(不带请求参数,参数位于$ar...原创 2019-08-03 13:42:53 · 4980 阅读 · 0 评论 -
lua 发送http请求
lua发送http请求,luajit默认没有http.lua库,需要下载并存放到luajit对应目录。一、下载http.lua和http_headers.lua库参考:https://www.zixuephp.net/article-448.htmlbashlocation=/testscript{ default_typetext/plain; c...原创 2019-08-03 11:43:44 · 22993 阅读 · 3 评论 -
lua 脚本
nginx 分发层原创 2019-05-04 21:33:39 · 410 阅读 · 0 评论