D
D
Denis Labutin2018-10-06 23:57:21
Computer networks
Denis Labutin, 2018-10-06 23:57:21

Organization of access to the local network from outside by domains?

Hello, there is a local grid.
There are two servers, a router, one ip, and two domains.
router -----> Server 1
|---> Server 2
There are two domains, how to attach each domain to the server with 1 ip?
Now done with crutches, nginx is running on 1 server and reverse_proxy is configured to the second server.
And on the router port forwarding to 1 server. It turns out like this Router <---> Server 1 <---> Server 2
How to do it humanly?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
V
vreitech, 2018-10-06
@fzfx

IMHO, quite humanely.
well you can buy a second IP...

P
Pavel K, 2018-10-07
@PavelK

Good day.
IMHO, raise ssh, raise your dns.

D
Daemon23RUS, 2018-10-07
@Daemon23RUS

The domain has several types of records, in particular, the A-record contains the IP address of the server. That is, it will be the same for both domain names. You didn't specify what kind of access (except ssh) you need, let's assume HTTP, it will be port 80 for both domains (+ the same IP). As a result, requests will be sent to your IP address on port 80, which the router will have to send to the desired server. The protocol will be HTTP, and it has the Host header, which will just reflect which server the request is to. That is, humanly, the decision where to send the packet should be made by the router by parsing the HTTP header (using nginx, lighthttp, firewall, etc.) hence the question: what kind of router do you have, and what can be "plugged" in there to solve the task.
For SSH, just spread it on different ports of the server,
it also eats DNS SRV records, but it depends on the SSH client, if it works for XMPP, SIP, etc.

X
xmoonlight, 2018-10-07
@xmoonlight

You need to drop the external port to where nginx is located.
Of course, it is better - if it is on the router.
And already on it it will be possible to resolve one port, depending on the requested domain name, through the rules of nginx or haproxy to the desired internal IP-shnik (of the desired server).
I.e. after connecting, all the necessary tunnels immediately rise and bind to 127.0.0.1.
Next, we can set up all the software to work through 127.0.0.1 and just start putty when you need to connect to several servers and their services on a remote network at once.

A
Alexander Karabanov, 2018-10-07
@karabanov

Nginx as a proxy is humanly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question