R
R
Radmir Ya2021-12-10 08:45:54
Nginx
Radmir Ya, 2021-12-10 08:45:54

How to make Nginx redirect both ways with multiple hosts?

stream {
upstream asdserv {
  server 10.20.10.10:1521;
}

upstream qweserv {
  server 10.10.10.11:1433;
}

  server {
  listen 1433 so_keepalive=on;
  listen 1521 so_keepalive=on;
  proxy_pass asdserv;

   }
  server {
  listen 10.20.10.11:1433;
  proxy_pass qweserv;

   }
   }

There are several servers with mssql, oracle, whose data I read on 10.20.10.10:1521 via nginx, everything works.
Then from these databases (10.10.10.10-15) it reads the data of the server 10.20.10.11
. Added an entry to hosts.
61b84736cffe4331612444.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2021-12-13
@dimonchik2013

you can go in any direction and back,
and if there is a hitch in something, then draw a diagram, and it will become clearer to us here what is needed and what is wrong

R
Radmir Ya, 2021-12-14
@rtgrttyhtruhrtergavwev

stream {
upstream asdserv {
  server 10.20.10.10:1521;
}
   server {
listen 1433 so_keepalive=on;
listen 1521 so_keepalive=on;
proxy_pass asdserv;
  }
  }

I did it like this, connecting to the database (10.21.10.10) turned out from under the server pool on the left, where the entries in the hosts are registered.
Now you need to send a request to one of the servers on the left side from 10.20.10.11. I also tried to create an upstream in order to access nginx by a virtual hostname, which in turn is tied to an ip address.
One moment: there is no access between the left and right servers. Only the nginx host has access to all servers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question