龙空技术网

nginx+lua灰度发布

悬钟Mr 4423

前言:

当前各位老铁们对“灰度发布 nginx”大约比较讲究,兄弟们都想要剖析一些“灰度发布 nginx”的相关知识。那么小编也在网上汇集了一些关于“灰度发布 nginx””的相关资讯,希望小伙伴们能喜欢,你们一起来学习一下吧!

upstream {

server 192.168.1.100:9000;

server 192.168.1.100:9000;

}

upstream {

server 192.168.1.100:9000;

server 192.168.1.100:9000;

}

server {

listen 80;

server_name ;

charset utf-8;

location ~ ^/webticket/WEB-INF/{

deny all;

}

#O

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 == "111.222.1.100" then

ngx.exec("@")

else

ngx.exec("@")

end

';

}

#A

location @{

proxy_pass ;

proxy_connect_timeout 60s;

proxy_read_timeout 5400s;

proxy_send_timeout 5400s;

proxy_redirect off;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

index index.html index.htm index.jsp;

}

#B

location @{

proxy_pass ;

proxy_connect_timeout 60s;

proxy_read_timeout 5400s;

proxy_send_timeout 5400s;

proxy_redirect off;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

index index.html index.htm index.jsp;

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

}

各项注释说明:

欢迎关注:悬钟Mr

标签: #灰度发布 nginx