nginx upstream会记录IP

参考:https://tenzer.dk/nginx-with-dynamic-upstreams/

AWS 的ALB地址定期会变,导致nginx upstream配置域名的时候,nginx会缓存ip记录,无法正常解析到后端。之前同事说是坑,我一直不信,等我遇到的时候。。。。。。。
希望你在配置微服务的时候,也会看到这篇文章,帮你更好解决问题

resolver 172.16.0.23;
set $upstream_endpoint http://service-1234567890.us-east-1.elb.amazonaws.com;
location /foo/ {
rewrite ^/foo/(.*) /$1 break;
proxy_pass $upstream_endpoint;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章