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/
欢迎大家访问:
我的博客