Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

ip_hash, how to

$
0
0
Hello

I have webserver application running on ports 82, 83 and 84, on same server. Here is my nginx conf:

worker_processes 1;
events {
worker_connections 1024;
}
#Server groups#
http {
upstream backend {
hash $remote;
ip_hash;
server localhost:82;
server localhost:83;
server localhost:84;
}
server {
listen 81;
location / {
proxy_pass http://backend;
}
}
}
What I need is that new clients (with different IP addresses) are connected like this:
Client1 to 82
Client2 to 83
Client3 to 84
Client4 to 82
Client5 to 83
etc.
With other words, new clients (with new IP address) need to be connected to different port.
Now, I have 3 clients running on different IP addresses and Client1 is connected to 82 but Client2 and Client3 are connected to 83 (to same IP).
How I need to write conf file that new clients are loaded balanced?
Thank you.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>