B4J Question multiple sites one server

Discussion in 'B4J Questions' started by TomDuncan, Sep 9, 2015.

  1. TomDuncan

    TomDuncan Active Member Licensed User

    If I have ctd.noip.me and tom.fred.com
    Can I serve both these sites from one IP address, one computer and one server.
    Sounded like a nice idea.
    Can it be done.

    Tom
     
  2. Daestrum

    Daestrum Well-Known Member Licensed User

    Providing each site connects on a different port it is possible.
     
  3. TomDuncan

    TomDuncan Active Member Licensed User

    But isn't a web site by default mapped to port 80?

    Also with noip I have two names both mapped to the same incoming IP address.
    I have ctd.noip.me and tomduncan.noip.me

    Can I have both of these serving different site layouts. I.e. Different www folders.
     
  4. Roycefer

    Roycefer Well-Known Member Licensed User

    You can serve up two sites but they'll have to be running in the same server program. In each Handler, you can get the full request URI which will tell you whether your user was navigating to ctd.noip.me or tomduncan.noip.me and then you can decide what content to serve to the user. In this case, you shouldn't give users direct access to statically served pages as they might have ambiguous links.

    Another option is to have one server be secure (default port 443) and the other be insecure (default port 80) and then you can have two separate, normal server applications serving up static pages.

    You can also specify port numbers in your domain name: ctd.noip.me:1111 and tomduncan.noip.me:2222 and then you could have these go to two separate server programs running on the same computer.
     
  5. Daestrum

    Daestrum Well-Known Member Licensed User

    It looks like no-ip allows you to redirect port 80 to any port you choose so you could have both running in one server program.
    Code:
    ...
    srvr.Initialize(
    "srvr")
    srvr.StaticFilesFolder = 
    "www" ' files for first site
    srvr.Port = 51000
    srvr.Start
    srvr1.Initialize(
    "srvr2")
    srvr1.StaticFilesFolder = 
    "www/1" ' files for second site
    srvr1.Port = 51001
    srvr1.Start
    ...
     
  6. TomDuncan

    TomDuncan Active Member Licensed User

    Does that mean on my modem I would redirect 51000 and 51001 to port 80

    No I am missing something here.
    How will it know to go to which port.
    Or www or www/1
     
    Last edited: Sep 10, 2015
  7. Erel

    Erel Administrator Staff Member Licensed User

    You should redirect each domain to a different port. I recommend you to use two server apps instead of one.
     
    TomDuncan likes this.
  8. Daestrum

    Daestrum Well-Known Member Licensed User

    As Erel recommended it's better to have two servers running, if the app crashes it only takes one site off-line not both.
     
    TomDuncan likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice