server {
    listen       80;
    server_name  sy.test.com;


    add_header X-Cache $upstream_cache_status;
    charset utf-8;
    access_log /data/nginxlog/sy.test.com.log;
    set $web_backend tomcat-test-scm-v1;
    if ($remote_addr ~ "x.x.x.x") {
        set $web_backend tomcat-test-scm-v2;
    }
    if ($remote_addr ~ "x.x.x.x") {
        set $web_backend tomcat-test-scm-v2;
    }
    set $hd_backend live-v1;
    if ($remote_addr ~ "x.x.x.x") {
        set $hd_backend live-v2;
    }
    if ($remote_addr ~ "x.x.x.x") {
        set $hd_backend live-v2;
    }
    location ~ ^/live {
        proxy_redirect  off;
        proxy_set_header Host  $host;
        proxy_pass      http://$hd_backend;
    }

    location ~ / {
        proxy_redirect  off;
        proxy_pass      http://$web_backend;
    }
}

引用自: 自己只是做个备注 笔记   感谢公众号SY技术小站

https://mp.weixin.qq.com/s?__biz=MzU0OTE1MTE3MA==&mid=2247483810&idx=1&sn=ad0b1176360b21a695fd197aeb9ff1d4&chksm=fbb5090fccc280197b1da2e074f82d0530d0883b2306964ddc5e00305a50703e65b9d2f5ebbc&mpshare=1&scene=1&srcid=&sharer_sharetime=1589848668014&sharer_shareid=6c98dc44e1b18a7c9b8dd9a90f88f4a9&key=f77084c7bd8d613f6666fedcdc6b8230d9f035600854986a93beec979ac0b14fd86bacbd7d0eeb82782aa59bf2447ac9011e5513a5322adb80f478fe8f41e777734b4f4f01327691ecb4cc998eb87250&ascene=1&uin=MjgyMzYwNjMwOQ%3D%3D&devicetype=Windows+10+x64&version=62090070&lang=zh_CN&exportkey=A2jK5H0%2By%2BB0Hrh2x7E91kk%3D&pass_ticket=WFL9ONhDTj96RIObpao1GjiaRukP94UbuXrr5vBfpuxWEDHUM%2FFcwlu1aPFB9LWB