The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

2 servers, 1 IP, how to configure

Discussion in 'General Discussion' started by max101, Oct 6, 2016.

  1. max101

    max101 Member

    Joined:
    Aug 1, 2015
    Messages:
    5
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    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?
     
  2. edenent

    edenent Member

    Joined:
    Jul 2, 2009
    Messages:
    23
    Likes Received:
    2
    Trophy Points:
    3
    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.
     
    #2 edenent, Oct 6, 2016
    Last edited: Oct 6, 2016
    cPanelMichael likes this.
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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!
     
  4. max101

    max101 Member

    Joined:
    Aug 1, 2015
    Messages:
    5
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    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!
     
    cPanelMichael likes this.
  5. edenent

    edenent Member

    Joined:
    Jul 2, 2009
    Messages:
    23
    Likes Received:
    2
    Trophy Points:
    3
    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
     
    cPanelMichael likes this.
  6. max101

    max101 Member

    Joined:
    Aug 1, 2015
    Messages:
    5
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Canada
    cPanel Access Level:
    Root Administrator
    update!

    i found an old hub at a used store for 3 bucks!

    its works! the hub has 4 ports,

    i now have 3 computers on 3 different ips, didn't even have to configure anything,


    awesome!
     
    cPanelMichael likes this.
Loading...

Share This Page