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农历黄历日期表

    在线演示 本地下载

  2. Python 函数定义和使用

    # 函数的概念 # 概念 # 写了一段代码实现了某个小功能; 然后把这些代码集中到一块, 起一个名字; 下一次就可以根据这个名字再次使用这个代码块, 这就是函数 # 作用 # 方便代码的重用 # 分解 ...

  3. 关于使用JAVA正则表达式报java.lang.StackOverflowError错误问题

    最近在使用hadoop做apache日志分析,发现测试数据没问题,但数据一多就出问题,报 java.lang.StackOverflowError错误,最后定位为正则表达式栈溢出,发现某些行的日志数据 ...

  4. Sub-process /usr/bin/dpkg returned an error code (1) 如何解决

    cd /var/lib/dpkg sudo mv info info.bak sudo mkdir info sudo dpkg --configure -a sudo apt-get install ...

  5. TCP_AIO_Server_ZC_01

    ZC: 这个例子是,1个skt 投递 1个未决的接收操作 1.package aio.Client; 1.1.这是一个 测试的客户端的代码: package aio.Client; import ja ...

  6. ECS vs. Kubernetes 类似而又不同

    C2Container Service (ECS)和Kubernetes (K8s) 都解决了同样的问题:跨越主机集群管理容器.ECS和Kubernetes之间的斗争让我想起了vi和Emacs之间的编 ...

  7. Amazon SES介绍 - SES发送邮件的过程

     Amazon SES,  全称Amazon Simple Email Service,即Amazon简单邮件服务,它是Amazon提供的一款供开发人员或公司企业用来处理邮件相关业务的服务,也就是说, ...

  8. listView使用小技巧P66--P76

    1.设置分割线高度和颜色 android:divider="@android:color/darker_gray" android:dividerHeight="10dp ...

  9. How to Have a Healthy Relationship --shanbei 为单身节写

    我在扇贝发现一片好文. Sometimes relationships can seem like a lot of work until you sit back and realize just ...

  10. PostgreSQL 全文检索

    PostgreSQL 8.3.1  全文检索(转) 在postgreSQL 8.3自带支持全文检索功能,在之前的版本中需要安装配置tsearch2才能使用,安转配置tsearch2就不再多说了,主要介 ...