openresty-1.13.6.1rc1 已经支持 ngx_http_mirror_module 了,


1. rc1 版本地址

     https://openresty.org/download/openresty-1.13.6.1rc1.tar.gz

 2. 构建

     准备环境  prce  openssl 

     yum   install   openssl   openssl-devel

     yum   install   pcre-devel

     ./configure   && gmake  && gmake install

2. 配置

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;

}

}

nginx 1.13.4 开始的 mirror 已经可以使用了,可以进行灰度以及流量拷贝了,春哥的更新速度还是挺快的

3. 参考文档

https://nginx.org/en/docs/http/ngx_http_mirror_module.html

http://www.jianshu.com/p/07e1d7207476

相关内容

    暂无相关文章