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/

posted @ 2019-07-05 21:01  聚变归来  阅读(5386)  评论(1编辑  收藏  举报