1. 下载源码编译
https://nginx.org/download/nginx-1.13.4.tar.gz
 
2. 下载依赖模块包
   
  这里直接yum 安装
yum -y install openssl openssl-devel
yum -y install pcre-devel
 
3. 安装
 
 可以直接默认  ./configure
 我是为了添加https 以及状态监测模块,还有四层负载均衡,比较好的地方是这个模块是
直接内置里面的。
./configure --prefix=/usr/local/nginx –with-http_ssl_module    –with-http_stub_status_module  -with-stream
make && make install
 
4.  使用
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
mirror /mirror; # 可配置多个
mirror_request_body off;
root html;
mirror /mirror2;
index index.html index.htm;
}
# mirror配置
location /mirror {
proxy_pass http://127.0.0.1:8080$request_uri;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
location /mirror2 {
proxy_pass http://127.0.0.1:8081$request_uri;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 8080;
server_name localhost;
location / {
root html2;
index index.html index.htm;
}
}
server {
listen 8081;
server_name localhost;
location / {
root html3;
index index.html index.htm;
}
}
 
5. 启动测试即可
/sbin/nginx -t
/sbin/nginx
 
6. 价值
 
  流量拷贝、以前的方案可能有tcpcopy  openresty  capture_multi 等等,
  原生内置了,就是好用,希望openresty 也内置进去,配置capture_muilt 还是有
  点不是很方便,如果结合起来,那就太强大了。
 
7. 待确认
 
  性能,稳定性,以及生产环境使用的坑。
 
8. 参考资料
https://nginx.org/en/docs/http/ngx_http_mirror_module.html
 
 
 
 
 

nginx 流量拷贝模块 ngx_http_mirror_module 安装试用的更多相关文章

  1. Nginx流量拷贝

    1. 需求 将生产环境的流量拷贝到预上线环境或测试环境,这样做有很多好处,比如: 可以验证功能是否正常,以及服务的性能: 用真实有效的流量请求去验证,又不用造数据,不影响线上正常访问: 这跟灰度发布还 ...

  2. OSX安装nginx和rtmp模块(rtmp直播服务器搭建)

    1.安装Homebrew,执行命令 1 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/ma ...

  3. Mac系统安装nginx+rtmp模块

    1.安装命令 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install) ...

  4. nginx的ngx_http_geoip2模块以精准禁止特定地区IP访问

    要求:对网站的信息,比如某个访问节点不想国内或者国外的用户使用,禁止国内或者国外或者精确到某个城市的那种情况. 解决方式:1.Cloudfalre来实现禁止特定国家的ip访问,比较简单,但是需要mon ...

  5. 新安装和已安装nginx如何添加未编译安装模块/补丁

    新安装和已安装nginx如何添加未编译安装模块/补丁 --http://www.apelearn.com/bbs/forum.php?mod=viewthread&tid=10485& ...

  6. goreplay(gor) golang 流量拷贝工具试用

    1. 项目地址 https://github.com/buger/goreplay 2. 安装 wget https://github.com/buger/goreplay/releases/down ...

  7. 已安装的nginx添加其他模块

    总体操作就是添加新模块并重新编译源码,然后把编译后的nginx可执行文件覆盖原来的那个即可.1 查看已安装的参数nginx -V拷贝那些巴拉巴拉的参数,后面编译的时候使用 2 下载相同版本号的源码,解 ...

  8. mac下Nginx+lua模块编译安装

    Nginx的nb之处就不说了,lua也是一个小巧的脚本语言,由标准C编写而成,几乎可以运行在所有的平台上,也非常强大,其他特性请自行度娘.nginx_lua_module是由淘宝的工程师清无(王晓哲) ...

  9. php5.5安装及phpmyadmin&nginx配置php模块

    安装php5.5: 下载源地址:rpm -Uvh rpm包安装:yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php ...

随机推荐

  1. 如何选择合适的MySQL数据类型

    一.MySQL数据类型选择原则 更小的通常更好:一般情况下选择可以正确存储数据的最小数据类型.越小的数据类型通常更快,占用磁盘,内存和CPU缓存更小. 简单就好:简单的数据类型的操作通常需要更少的CP ...

  2. Android震动vibrator(马达)--系统到驱动的流程【转】

    本文转载自:https://blog.csdn.net/tianshiyalin/article/details/17136723 一.前言 本人刚学习安卓驱动开发,水平不能说菜,是根本没有水平,在这 ...

  3. [BZOJ2815]灾难

    题目描述 阿米巴是小强的好朋友. 阿米巴和小强在草原上捉蚂蚱.小强突然想,如果蚂蚱被他们捉灭绝了,那么吃蚂蚱的小鸟就会饿死,而捕食小鸟的猛禽也会跟着灭绝,从而引发一系列的生态灾难. 学过生物的阿米巴告 ...

  4. 【bzoj5427】最长上升子序列(贪心+LIS)

    题目传送门:https://www.lydsy.com/JudgeOnline/problem.php?id=5427 因为noip,博客咕了好久,这几天集中填一下坑. 这题我们可以假设往不确定的空位 ...

  5. LeetCode——Sum of Two Integers

    LeetCode--Sum of Two Integers Question Calculate the sum of two integers a and b, but you are not al ...

  6. SpringMVC的HelloWorld快速入门!

    1.加入JAR包: commons-logging-1.1.3.jar spring-aop-4.0.0.RELEASE.jar spring-beans-4.0.0.RELEASE.jar spri ...

  7. node 模块部分介绍

    chai  断言框架 mocha mochawesome  对mocha 定制报告,生成完整成熟的报告. node-fetch  服务器版fetch superagent  是node 客户端请求代理 ...

  8. python学习笔记(excel简单操作)

    现在的目标是设计一个接口自动化测试框架 用例写在excel里面 利用python自带的pyunit构建 之前已经安装好了处理excel的模块 这次简单的使用下 提前创建好excel文件 “testca ...

  9. 前端读取Excel报表文件 js-xlsx

    1.http://www.cnblogs.com/imwtr/p/6001480.html (前端读取Excel报表文件) 2.https://github.com/SheetJS/js-xlsx

  10. Sunday算法--C#版

    public static int Sunday(string text, string pattern) { int i, j, m, k; i = j = 0; int tl, pl; int p ...