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. jQuery带小图标的Tab切换焦点图

    在线演示 本地下载

  2. BeatSaber节奏光剑双手柄MR教程

    一.物料准备: 1 显卡1060及以上的PC主机 2 HTC VIVE头盔一套(头盔直插显卡上的HDMI接口) 3 1080P摄像头一个(插USB3.0) 4 绿幕一套,能覆盖整个摄像头的可拍摄范围即 ...

  3. 网络性能监测工具smokeping

    smokeping简介: smokeping是rrdtool的作者Tobi Oetiker的作品,所以它在图形显示方面有很大优势,也是一个很有特点的opensource工具:多种探测方式,包括fpin ...

  4. 线段树的lazy(poj3468)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 73163   ...

  5. SpringBoot @Annotation

    Annotation简介 Annotation是JDK1.5引入的特性,包含在java.lang.annotation包中. 它是附加在代码中的一些元信息,将一个类的外部信息与内部成员联系起来,在 编 ...

  6. Define class with itself as generic implementation. Why/how does this work?

    https://stackoverflow.com/questions/10709061/define-class-with-itself-as-generic-implementation-why- ...

  7. painting fence - 分治 - Codeforces 448c

    2017-08-02 14:27:18 writer:pprp 题意: • 每块木板宽度均为1,高度为h[i] • n块木板连接为宽度为n的栅栏 • 每次可以刷一横或一竖(上色) • 最少刷多少次可以 ...

  8. 智课雅思词汇---二十三、名词性后缀mony

    智课雅思词汇---二十三.名词性后缀mony 一.总结 一句话总结:Latin: action, result of an action or condition; a suffix that for ...

  9. Java反射深入浅出

    在JVM中对一个类实例的创建,有两种方式,一种是编译时,一种是运行时.两种方式在开发过程中都是十分重要的.在Java中无时无刻无处不在的Java对象,实例化的过程也就变得尤为引人瞩目.我们经常用new ...

  10. spring3: 延迟初始化Bean

    3.3.1  延迟初始化Bean 延迟初始化也叫做惰性初始化,指不提前初始化Bean,而是只有在真正使用时才创建及初始化Bean. 配置方式很简单只需在<bean>标签上指定 “lazy- ...