August 2017
Intermediate to advanced
278 pages
8h 53m
English
For those who have used older versions of NGINX, the ip_hash method is still available, but with one distinct difference. The ip_hash method uses the first three octets of an IPv4 address (for example, 1.2.3.XXX) to produce the hash map. This means that if the requesting IP comes from a different IP within the standard class C range, it'll be sent to the same upstream server. Here's an example of how it's implemented:
upstream localapp {
ip_hash;
server 127.0.0.1:8080;
server 127.0.0.1:8081;
server 127.0.0.1:8082;
}
While this method still works, if you need better consistency for ip_hash mapping, then using hash $remote_addr will match the full IP address.
Read now
Unlock full access