R
R
RedSs2019-09-23 11:33:14
Nginx
RedSs, 2019-09-23 11:33:14

Redirecting nginx traffic from different ips?

It is necessary to correctly configure redirected traffic queues so that if the server receives traffic from the application server (10.1.87.208), then the traffic is sent to (109.100.15.157 or 109.100.15.158 ) and if the traffic comes from these ips from outside, then the server sends it to the application server ( 10.1.87.208).
I tried to do it myself according to analogues, it turned out like this, but I guess I made a mistake somewhere.

upstream activemq_out {
        server 109.100.15.157:61616;
        server 109.100.15.158:61616;
    }
 upstream activemq_in {
        server 10.1.87.208:61616;
     }
   
    map "$remote_addr" $upstream_class
    {
       # default "backend";
        "~109.100.15.157" "activemq_in";
  "~109.100.15.158" "activemq_in";
  "~10.1.87.208" "activemq_out";

    }

  server {
        listen 61616;
        #server_name localhost;
        proxy_pass http://$upstream_class;
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2019-09-23
@ky0

Make separate blocks serverfor the local address and the external one (as an option, spread them over different ports) and set up different request processing inside them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question