博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
tengine + lua 实现流量拷贝
阅读量:4627 次
发布时间:2019-06-09

本文共 1781 字,大约阅读时间需要 5 分钟。

环境搭建参考地址:http://www.cnblogs.com/cp-miao/p/7505910.html

cp.lua
local res1, res2, actionaction = ngx.var.request_methodif action == "POST" then        arry = {method = ngx.HTTP_POST, body = ngx.req.read_body()}else        arry = {method = ngx.HTTP_GET}endif ngx.var.svr == "on" then        res1, res2 = ngx.location.capture_multi {                { "/copynode" .. ngx.var.request_uri , arry},        }else        ngx.exec("@hubnode")endngx.exec("@hubnode")

  

cp.conf
upstream hubnode {    server 127.0.0.1:3001 weight=1;    }upstream cpnode {        server  127.0.0.1:9031;}server {        listen  443;        server_name aa.cn;        ssl on;        ssl_certificate /etc/ssl/private/all_a.pem;        ssl_certificate_key /etc/ssl/private/all_a.pem;        location ~* ^/copynode {                log_subrequest on;                rewrite ^/copynode(.*)$ $1 break;                proxy_set_header Host $host;                proxy_set_header X-Real-IP $remote_addr;                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;                proxy_pass http://cpnode;                #access_log logs/test-upstream.log main;        }        location @hubnode{                proxy_pass  http://hubnode;                proxy_set_header   Host    $host;                proxy_set_header   X-Real-IP   $remote_addr;                proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;                proxy_set_header   X-Forwarded-Proto  $scheme;        }        location / {                client_body_buffer_size 2m;                set $svr     "on";               #开启或关闭copy功能                content_by_lua_file    "/nas/config/tengine/lua/t.lua";        }        access_log /var/log/tengine/np.log access;}

  

 

转载于:https://www.cnblogs.com/cp-miao/p/8253113.html

你可能感兴趣的文章
CH03_06.mxml 一个文本输入框复制到另外一个文本输入框
查看>>
malloc/free和new/delete
查看>>
spoj104 highways 生成树计数(矩阵树定理)
查看>>
nginx配置多个域名
查看>>
ARM寻址方式
查看>>
pandas之时间序列
查看>>
补肾的十大食物是什么?
查看>>
iPhone开发之 - 苹果推送通知服务(APNs)编程
查看>>
ASP常用读取数据2个调用方式
查看>>
【大话UWB定位】之蓝牙定位的烦恼
查看>>
算法3-高级排序
查看>>
每天一个linux命令(17):whereis 命令
查看>>
Angular4+路由
查看>>
Codeforces-234C Weather
查看>>
面向对象编程思想及其相关内容
查看>>
Leetcode解题笔记-3sum
查看>>
Android 3.0 Hardware Acceleration
查看>>
谈谈Delphi中的类和对象1---介绍几个概念 && 对象是一个地地道道的指针
查看>>
【2011 Greater New York Regional 】Problem G: Rancher's Gift
查看>>
java常见题目总结
查看>>