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.

How does one setup a redirect for a site when it is down?

Discussion in 'General Discussion' started by stardotstar, Oct 12, 2009.

  1. stardotstar

    stardotstar Well-Known Member

    Joined:
    Sep 14, 2009
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Hi Guys,

    I have a website on another server that is the "www." of a domain on my WHM host.

    Ie the tld is an account on the WHM/cPanel server but the A record for www. points to another server on another IP...

    This is fine because I have the domain functions including mail and dns etc all on my whm server but the database intensive community board is on a dedicated server.

    What I want to do is set up a method whereby users are directed to an informational page or site on my whm host when/if the other server goes down.

    Because there is no redirect or redundancy the users have traditionally headed off to an allied bb where I have a triage thread that I update when things go 404.

    I would appreciate any suggestions. I am sure this is a very common proposition - wondering how it is tackled the "whm way".

    BTW I have already thought to make the www. A record a permanent or temp redirect from the whm/cPanel account and then simply edit that when the other server goes 404 but don't want to just start hacking around till I get some sound advice. I am mindful of people's bookmarks and cookie domains etc...

    Cheers,
    Will
     
  2. ChrisFirth

    ChrisFirth Active Member
    PartnerNOC

    Joined:
    Apr 10, 2008
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    DataCenter Provider
    Hi Will,

    I will start this post off by saying I am unsure of how you can do this through WHM or if it is even possible through WHM, although we have done a similar setup with ldirectord running on our load balancers by setting a "fallback" host.

    Basically, you can tell ldirectord to check to make sure a service (eg. HTTP/POP/IMAP etc.) is running on the remote host (and even configure ldirectord to check the response to make sure its all OK, we have our ldirectord requesting a php script that connects to the mysql database and checks to make sure it can reach everything it should be able to, so in the event of a mySQL server crash or permissions issue it will just come up with an unavailable page).

    If the service is not running it can then direct the request to the fallback host you have set.

    In your case this may not be an ideal solution as you will need to deploy a server (or two for HA), but in our case we already have the hardware there so it was ideal.
     
  3. stardotstar

    stardotstar Well-Known Member

    Joined:
    Sep 14, 2009
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Interesting Chris. Thank you.

    I will have a google at ldirectord.

    Your argument leads me to several other things that I had not properly considered.

    Of course you are right - there can be a fallback site available but unless there is a mechanism that correctly identifies that it is necessary to invoke it it is redundant.

    In the simpelest case I suspect running something like a script test for active html/php/mysql on the target server can alert me to change a redirection manually - and eventually in an automated fashion.

    I thought that perhaps this could be done with DNS but the more I consider it the more I see that this is not a name resolution problem at all - sure I need to be able to direct the client browser to an alternative destination in a given circumstance.

    Can I setup the www.domain.com (which actually resides on the other server) on the WHM server and then put a permanent redirect in place to the www.domain.com/bb on the other server - that way the domain cookies and architecture of the site is unchanged but the IP redirection is in place already. Then if I get a report that the remote IP site is not playing ball I can remove the redirect rule in WHM/cPanel and users will immediately see the fallback site.

    Can anyone see any issues with trying to do this?

    It would require the ability to have

    www.domain.com/bb on IP2 (remote server with apache/mysql)
    www.domain.com on IP1 as the www root for the "domain.com" account on WHM/cPanel with a fallback site in place
    then a permanent redirect to IP2 www.domain.com/bb
    but that won't work because there is only one name resolution at any time for www.domain.com

    To make this work I would have to run the site at say,

    bb.domain.com/bb on IP2 (remote server with apache/mysql)
    www.domain.com on IP1 as the www root that everyone already has bookmarked and cookies for then redirect to

    bb.domain.com/bb - perhaps I could do that with url rewrites - I am completely confused now - but maybe closer to understanding what I want to do.

    Thanks for the reply I am interested in any other thoughts on what must be a common issue.

    (BTW I have two physical servers. One is the bulletinboard server and the other is the shared hosting WHM/cPanel one)

    Will
     
Loading...

Share This Page