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

推荐订阅源

Google DeepMind News
Google DeepMind News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Threat Research - Cisco Blogs
G
GRAHAM CLULEY
The Hacker News
The Hacker News
S
Securelist
K
Kaspersky official blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
AWS News Blog
AWS News Blog
H
Hacker News: Front Page
P
Privacy & Cybersecurity Law Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News | PayPal Newsroom
Project Zero
Project Zero
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
The Cloudflare Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tenable Blog
The Last Watchdog
The Last Watchdog
大猫的无限游戏
大猫的无限游戏
C
Check Point Blog
S
Schneier on Security
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
月光博客
月光博客
博客园_首页
V
Visual Studio Blog
宝玉的分享
宝玉的分享
IT之家
IT之家
PCI Perspectives
PCI Perspectives
MyScale Blog
MyScale Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Troy Hunt's Blog
F
Fortinet All Blogs
U
Unit 42
Help Net Security
Help Net Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
J
Java Code Geeks
aimingoo的专栏
aimingoo的专栏
Jina AI
Jina AI
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
MongoDB | Blog
MongoDB | Blog
G
Google Developers Blog
人人都是产品经理
人人都是产品经理
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - Franky

博客园 - 大侠(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;