2 servers, 1 IP, how to configure

max101

Member
Aug 1, 2015
6
2
53
Canada
cPanel Access Level
Root Administrator
I'm trying to get more experienced with both windows server and linux server.

I set up 2 servers, my first server using windows server and my 2nd server using CentOS

I have extra domains that i never use, so i will use them with these servers.

I am using cloudflare and my ip is 87.xxx.xxx.xxx


So, example:


my first server(windows server)

1stdomain.com dns points to ---> cloudflare dns points to ----> 87.xxx.xxx.xxx

and volia! i can see my website. My 1st server is working



my second server(CentOS server)
2stdomain.com dns points to ---> cloudflare dns points to ----> 87.xxx.xxx.xxx


But it's not working. All i get is "HTTP Error 404. The requested resource is not found."



Is it because both domains are pointed to the same ip? and i didn't specify a port?


How can i specify the domains to point to the same ip but port

1stdomain.com--->cloudflare--->87.xxx.xxx.xxx:80--->
2nddomain.com--->cloudflare--->87.xxx.xxx.xxx:81--->




i forgot to mention internally 1st server is at : 192.168.1.101 and 2nd server is at 192.168.1.102



So should i get the domain to point to
1stdomain.com--->cloudflare--->87.xxx.xxx.xxx--->192.168.1.101:80
2nddomain.com--->cloudflare--->87.xxx.xxx.xxx--->192.168.1.102:80


I'm a little confused. I'm not sure where i have to configure, cloudflare, domain, server? or use ports 80 & 81,

I'm lost,


anyone ran 2 servers from the same ip before?
 

edenent

Member
Jul 2, 2009
23
2
53
You will need different http ports ect, CloudFlare is basically just reverse proxy to your server. If Server 1 is running a Web Server and Server 2 is running a Web Server off of 1 IP, can you see were conflicts would happen if both are trying to take request on port 80/443 ect from 1 IP address.

You can do a 1:1 NAT and server 1 can be 80 and Server 2 can be 8080, but then you still have mail, Https, DNS and other functions that will run into port issues unless Server 1 is say mail server for both machines.
 
Last edited:
  • Like
Reactions: cPanelMichael

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Hello,

I recommend obtaining an additional IP address for use with the second server. Otherwise, it's going to require manual customization for each service to get it working, as mentioned in the post above.

Thanks!
 

max101

Member
Aug 1, 2015
6
2
53
Canada
cPanel Access Level
Root Administrator
I was able to get it working on a different port, but the user has to add :8080 at the end of the domain. Annoying. But since it's just for practice and only i know the domain, it's ok.


I also found out i have 3 ips! My isp gives me 3 ips with my internet plan. So it's good news. The bad news is my router is not capable of configuring more than 1 static ip.

Looks like i'm going to have to buy a switch/hub.

thanks!
 
  • Like
Reactions: cPanelMichael

edenent

Member
Jul 2, 2009
23
2
53
I was able to get it working on a different port, but the user has to add :8080 at the end of the domain. Annoying. But since it's just for practice and only i know the domain, it's ok.


I also found out i have 3 ips! My isp gives me 3 ips with my internet plan. So it's good news. The bad news is my router is not capable of configuring more than 1 static ip.

Looks like i'm going to have to buy a switch/hub.

thanks!
Most router can't, if you have a low end PC laying around with dual NIC's Intel or Broadcom you can use it and install pfSense and add your main IP to WAN interface, set your LAN up. After that you can create virtual ip's for your 2 extra out of your 3 total and do 1:1 Nat. cPanel with detect Nat Mode but requires extra tweaking.

You can also run out to a Wal-Mart or a Bestbuy or whatever and get a cheap unmanaged 5 port switch and hook it in between your modem and your router, plug servers into it and give them static IP's.

Attempt at diagram with lines. Not pretty but for testing purposes it should work.

---- Modem ----
-
-
---- Switch ------------------
- - Server 1
- - Server 2
-
-
---- Router -----
-
-
LAN
 
  • Like
Reactions: cPanelMichael