惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
M
MIT News - Artificial intelligence
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
罗磊的独立博客
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
有赞技术团队
有赞技术团队
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog
美团技术团队
F
Fortinet All Blogs
I
Intezer
IT之家
IT之家
T
Threat Research - Cisco Blogs
Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AWS News Blog
AWS News Blog
P
Palo Alto Networks Blog
S
Securelist
L
LINUX DO - 热门话题
Security Archives - TechRepublic
Security Archives - TechRepublic
N
Netflix TechBlog - Medium
TaoSecurity Blog
TaoSecurity Blog
Scott Helme
Scott Helme
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Project Zero
Project Zero
U
Unit 42
博客园_首页
博客园 - 司徒正美
S
Security Affairs
V
V2EX
T
Threatpost
T
Tailwind CSS Blog
GbyAI
GbyAI
O
OpenAI News
K
Kaspersky official blog
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
H
Hacker News: Front Page
V2EX - 技术
V2EX - 技术
Security Latest
Security Latest

博客园 - 大侠(cer)

阿里巴巴又抄袭创业公司产品,这次已被告上法庭(一) 手机app传统邀请码安装与免邀请码安装区别,如何选择呢? 好用的一些开源系统 一个搞笑的招聘启事 java和android及IOS对接RSA加密经验 mysql大数据表改表结构方案 android开发中监控android软件网络请求的软件Charles使用入门 android IOC框架学习记录 java分布式事务 android开发时使用游标时一定要关闭 今天发现ConcurrentHashMap的key是不区分大小写的 js方法isNaN使用时注意,“1.”这样子的东西他也会认为是数字 nginx增加lua支持 两台机器使用rsync同步数据(手工执行命令同步)(使用推的方式) 用户中心 - 博客园 ubuntu服务器配制jmagick环境 windows中架设基于Apache的svn服务器 amoeba学习 CentOS安装thrift
使用nginx+lua实现web项目的灰度发布
大侠(cer) · 2012-09-29 · via 博客园 - 大侠(cer)

1.问题:小团队,快速迭代开发,版本发布没有经过测试就要放出去,怎样在内网测试过后在外网能在真实环境让内部人员再过一次测试且不影响外网用户

2.实现思想:

a.至少要有两台机器

b.公司是统一出口IP

c.根据IP将请求转发到不同的机器

3.nginx配制: 

location / {

content_by_lua '

            myIP = ngx.req.get_headers()["X-Real-IP"]

            if myIP == nil then

                myIP = ngx.req.get_headers()["x_forwarded_for"]

            end

            if myIP == nil then

                myIP = ngx.var.remote_addr

            end

            if myIP == "公司出口IP" then

                ngx.exec("@client")

            else

                ngx.exec("@client_test")

            end

        ';

location @client{

    proxy_next_upstream     error timeout;

    proxy_redirect          off;

    proxy_set_header        Host $host;

    #proxy_set_header        X-Real-IP $remote_addr;

    proxy_set_header        X-Real-IP $http_x_forwarded_for;

    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

    client_max_body_size    100m;

    client_body_buffer_size 256k;

    proxy_connect_timeout   180;

    proxy_send_timeout      180;

    proxy_read_timeout      180;

    proxy_buffer_size       8k;

    proxy_buffers           8 64k;

    proxy_busy_buffers_size 128k;

    proxy_temp_file_write_size 128k;

    proxy_pass http://client;

}

location @client_test{

    proxy_next_upstream     error timeout;

    proxy_redirect          off;

    proxy_set_header        Host $host;

    #proxy_set_header        X-Real-IP $remote_addr;

    proxy_set_header        X-Real-IP $http_x_forwarded_for;

    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

    client_max_body_size    100m;

    client_body_buffer_size 256k;

    proxy_connect_timeout   180;

    proxy_send_timeout      180;

    proxy_read_timeout      180;

    proxy_buffer_size       8k;

    proxy_buffers           8 64k;

    proxy_busy_buffers_size 128k;

    proxy_temp_file_write_size 128k;

    proxy_pass http://client_test;