nginx的url_hash配置,表示什么意思.

nginx的url_hash配置,表示什么意思.

upstream img1{
server 192.168.100.1;
server 192.168.100.2;
}
upstream img2{
server 192.168.100.1:81;
server 192.168.100.2:82;
}
   
location ~ ^/[0-1][0-f]/ {
proxy_pass http://img1;
}
location ~ ^/[2-3][0-f]/ {
proxy_pass http://img2;
}


红色的表示是什么意思?
1.url_hash的使用.感觉上面的方法设置不当.搞不明白什么意思.建议使用ngx_http_upstream_hash_module

2.
upstream backend {
    server server1;
    server server2;
    hash   $request_uri;
    hash_again 100;
}

Here, Nginx will choose server1 or server2 by hashing the request URI ($request_uri).
Number of times to rehash the value and choose a different server if the backend connection fails. Increase this number to provide high availability.
感觉这种方法.配置起来比较方便.测试通过.