Answer the question
In order to leave comments, you need to log in
How to set up 2 Web servers on 1 ip?
Good afternoon. There was such a situation: the company has 2 servers (Debian 9), Internet access from 1 white ip address.
External ip address: 62.200.222.180 (Internet)
Internal ip address of WebServ1: 192.168.12.220
Internal ip address of WebServ2: 192.168.12.225 (Moodle)
Each server has its own website. But one domain is registered: firma.ru. The task is this: to raise it under the domain in the form of e.firma.ru, so that users from the Internet would have access to it. (I registered the subdomain with the provider and in the local network too)
What was done: it was written on Mikrotik that incoming connections to the external 62.200.222.180:80 were redirected to 192.168.12.220:80(webserv1). Everything is simple here. And here with the second server of a problem. I tried to prescribe that if incoming connections are received at 62.200.222.180:8000 , redirect to the second server 192.168.12.225:80 (WebServ2). The server has opened, the site has loaded (Moodle), the link looks like this: e.firma.ru:5000 . After clicking on some link, it changes to e.firma.ru/course/view.php?id=4 and doesn't load. (port ignored)
Access to the first server is denied, and redirection from the first server to the second cannot be done.
Question: How can I make the site (Moodle) on the second server open without a port from the local network, but with a port (5000) from the Internet?
Thanks for answers.
Here is the usual nginx config:
Answer the question
In order to leave comments, you need to log in
You will have to work with the documentation or Google (for examples of proxy_pass), but here is the algorithm in which you need to move:
* On Mikrotik, you leave one forwarding of port 80 on 192.168.12.220:80 and forget about Mikrotik on this
* On the server 192.168. two listeners bound to the names firma & e.firma, one will apparently open the site locally, and the second will proxy requests to your second server by name on 192.168.12.225 port 80 too.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question