Welcome! Log In Create A New Profile

Advanced

ip_hash, how to

Posted by krosoftware 
ip_hash, how to
April 22, 2017 04:41AM
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.
Re: ip_hash, how to
April 24, 2017 03:09AM
Anybody, please?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 307
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready