nginx 流量拷贝模块 ngx_http_mirror_module 安装试用
2017-08-14 09:47
2491 查看
1. 下载源码编译
2. 下载依赖模块包
这里直接yum 安装
3. 安装
可以直接默认 ./configure
我是为了添加https 以及状态监测模块,还有四层负载均衡,比较好的地方是这个模块是
直接内置里面的。
4. 使用
5. 启动测试即可
6. 价值
流量拷贝、以前的方案可能有tcpcopy openresty capture_multi 等等,
原生内置了,就是好用,希望openresty 也内置进去,配置capture_muilt 还是有
点不是很方便,如果结合起来,那就太强大了。
7. 待确认
性能,稳定性,以及生产环境使用的坑。
8. 参考资料
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_accesskey_module防盗链
- nginx 动态缩略图模块安装(ngx_http_image_filter_module)
- Nginx最新模块—ngx_http_mirror_module分析
- nginx 的第三方模块ngx_http_accesskey_module 来实现下载文件的防盗链步骤(linux系统下)
- Nginx 负载均衡模块 ngx_http_upstream_module 详述
- nginx模块之ngx_http_proxy_module
- 详细解释:nginx中ngx_http_access_module模块(HTTP Access 模块)配置及各个参数含义
- 解剖Nginx·模块开发篇(3)ngx_http_hello_world_module 模块的基本函数实现
- 解剖Nginx·模块开发篇(2)ngx_http_hello_world_module 模块基本结构定义
- nginx限制连接数ngx_http_limit_conn_module模块笔记:二
- Nginx 负载均衡模块 ngx_http_upstream_module 详述
- Nginx 负载均衡模块 ngx_http_upstream_module 详述
- 详细解释:nginx中ngx_http_access_module模块(HTTP Access 模块)配置及各个参数含义
- nginx图片过滤处理模块http_image_filter_module安装配置笔记
- 解剖Nginx·模块开发篇(3)ngx_http_hello_world_module 模块的基本函数实现
- 比ngx_http_substitutions_filter_module 更强大的替换模块sregex的replace-filter-nginx-module
- Nginx服务器工作状态ngx_http_stub_status_module 模块
- nginx监控模块http_stub_status_module安装
- nginx下后端realserver健康检测模块ngx_http_upstream_check_module
- Nginx 模块之 ngx_http_limit_req_module 请求处理模块用法