nginx负载均衡策略url_hash配置方法


参考文章:

https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/
根据路径,进行一致性hash,具体的配置方法

upstream backend {
    hash $request_uri consistent;
    server backend1.example.com;
    server backend2.example.com;
}

需要注意的是:顺序不能错,否则会报错

nginx: [warn] load balancing method redefined in /etc/nginx/conf.d/upstream.conf:5

https://ma.ttias.be/nginx-nginx-warn-load-balancing-method-redefined/


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM