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. 20145109 《Java程序设计》第六周学习总结

    Chapter 10 I/O 10.1 InputStream & OutputStream a new 'try' edition: try (InputStream input = src ...

  2. Qt debug和release

    debug会默认给变量赋初始值,但是release不会. 所以: 在头文件中声明指针P* p时,最好给它初始化:P* p=NULL; 不然有可能造成野指针的情况

  3. maven项目在eclipse的library中没有Maven Dependencies

    今天使用maven创建了一个多模块的项目,在分别创建完父项目和各个子模块后,编译父项目的时候,父项目工程目录上出现了一堆红叉叉,点进去一看,是找不到依赖的类,但是pom文件中相应jar的depende ...

  4. libc.so.6(GLIBC_2.14)(64bit) is needed by MySQL

    记一次粗心大意!解决办法在最下面! rpm安装MySQL时提升如下: warning: MySQL-client-5.6.41-1.el7.x86_64.rpm: Header V3 DSA/SHA1 ...

  5. SpringBoot 密码MD5加密

    public class PasswordEncrypt { public static String encodeByMd5(String string) throws NoSuchAlgorith ...

  6. Spring 静态注入讲解(MethodInvokingFactoryBean)

    /* * Copyright (c) 2017 4PX Information Technology Co.,Ltd. All rights reserved. */package com.fpx.o ...

  7. Substring with Concatenation of All Words, 返回字符串中包含字符串数组所有字符串元素连接而成的字串的位置

    问题描述:给定一个字符数组words,和字符串s,返回字符数组中所有字符元素组成的子串在字符串中的位置,要求所有的字符串数组里的元素只在字符串s中存在一次. 算法分析:这道题和strStr很类似.只不 ...

  8. NumPy来自数值范围的数组

    NumPy - 来自数值范围的数组 这一章中,我们会学到如何从数值范围创建数组. numpy.arange 这个函数返回ndarray对象,包含给定范围内的等间隔值. numpy.arange(sta ...

  9. linux安装----gcc

    Linux中gcc是个编译工具,可以将源码文件(c c++ java文件) 编译成 二进制文件.

  10. vmware增加共享文件夹

    增加共享文件夹 VMWare提供共享文件夹功能.前提是在虚拟机中安装VMware tools 1. 安装VMware tools 会自动在虚拟机中的/media/VMware Tools/中有个压缩包 ...