P
P
pauloriply2016-07-22 12:42:43
Virtualization
pauloriply, 2016-07-22 12:42:43

How to connect several virtual servers and bring them to the Internet through one IP?

Hello everyone, and good mood!
I appeal to everyone who reads this topic for help and advice.
Together with friends and like-minded people, we decided to open our own small "desk" of web developers.
Essence of the question:
1) There is a fiber optic channel from the provider.
2) There is a dedicated IP
3) There is a hosting provider (just for reference), but in the future we will refuse.
4) There is a registered domain name
5) There is a Dell PowerEdge R610 server, which has 4 network adapters of 1Gb (each), which is located in our small office
6) The fiber is connected to Mikrotik 751U, and from it there is access to a gigabit switch.
7) Server virtualized via ESXi
8) There are 4 virtual servers installed on the server (2 web servers (Apache, PHP, MySQL) (1 server - Redmine Virtual Machine) (1 Samba server))
9) Each virtual server naturally has its own local IP
Strictly speaking, you need to display 3 servers to the Internet, while having 1 IP.
But everything needs to be done so that the Internet user enters, for example (server1.com - and got to the 1st web server), (server2.com - and got to the 2nd web server), (server3.com - and got on the web server with Redmine), while the Internet user should not perform any additional manipulations with the forced indication of ports.
Thank you all in advance for your help.
If you need any more clarification information, naturally I will add.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cool Admin, 2016-07-22
@pauloriply

0. Install another virtual server with nginx on board nginx.org/ru/docs/install.html
1. Direct ports 80 and 443 from the external interface to it via NAT on Mikrotik

/ip firewall nat
add action=dst-nat chain=dstnat dst-address=%WAN_IP% dst-port=80 in-interface=WAN protocol=tcp to-addresses=%NGINX_IP% to-ports=80
add action=dst-nat chain=dstnat dst-address=%WAN_IP% dst-port=443 in-interface=WAN protocol=tcp to-addresses=%NGINX_IP% to-ports=443

2. configure reverse proxy module on nginx
server {
      listen 80;
      server_name server1.com;
      location / {
        proxy_pass http://server1;
      }
    }
server {
      listen 80;
      server_name server2.com;
      location / {
        proxy_pass http://server2;
      }
    }

3. In the dns, enter the external address of Mikrotik as the names of your sites.
server1.com A %WAN_IP%
server2.com A %WAN_IP%

As many names as you want, as many entries as you want in the reverse proxy.

S
silverjoe, 2016-07-22
@silverjoe

Why not buy a subnet from an ISP? for example /29 - will give you 6 IP addresses?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question