nginx upstream利用ip实现灰度发布项目

nginx upstream利用ip实现灰度发布项目

upstream prod {
     
    server 192.168.1.10;
    server 192.168.1.11;
}
upstream pre-prod {
     
    server 192.168.1.100;
}
server {
     
    listen 80;
    access_log /var/log/nginx/access.log main;
    set $web_backend prod;
    if ($remote_addr ~ "123.123.123.123") {
     
        set $web_backend pre-prod;
    }
    location / {
     
        proxy_pass http://$web_backend;
        include proxy.conf;
    }
}

你可能感兴趣的