3

I have a challenge since I'm not sure how to accomplish this:

I have a NO-IP account in order to host some websites from my local computer server at home. I need to migrate some of this website to online web hosting for high availability. I have a good server at home, so I just need to replicate it to online web hosting so I can accomplish high availability.

I wish I could lease a lower 1 core, 1GB RAM web hosting account to be the second server in order to serve requests if my home server fails.

The architecture should follow something like this:

  • NO-IP points primarily to my local home server
  • NO-IP points to the online web hosting if my local home server doesn't reply
  • Since I'm using NO-IP, I think I can still use www.example.com regardless of which server I'm pointing to. In the case that's not possible, I think I can have www.example.com point to my local home server and alpha.example.com point to the online web hosting.

Now as far as I know, the real issue is this:

  • Web hosting would require domain registration, otherwise I could use a dummy web address like abc.hosting.com. So when redirecting, the hosting would appear in the URL and that's not professional looking.

So how might I configure this architecture, or a similar alternative?

  • do you actually need to lease a machine for VPS services for applications? (like irc, socket.io, or jitisi for example). If they are just flat html pages or just php/mysql you should be able to get by with a standard share hosting (shopping around, ipage is around $150/3yrs with unlimited space, domains, and stuff) – drtechno May 14 '18 at 17:39
2

The feature that you are looking for is called DNS Failover. No-IP offers it under their $150/year monitoring package.

If you are going to lease a server in a data center, I would suggest using it as the primary server. I use a data center to host my websites and use my home computer as a development machine and staging server.

  • Thank you for the answer and... correct me If necessary but, Is it related to DNS Round Robin somehow? – BlackStar May 18 '17 at 18:40
  • Round robin is where you specify two different A records with different IP addresses for the same host name. Then one or the other gets used randomly. With round robin, if one of your two servers goes down, half your users get an error. With DNS Failover, the A record gets changed to a different IP address when the monitoring service detects an outage. – Stephen Ostermiller May 18 '17 at 18:41
1

There is a way of doing this without using a dns fail over server. in the fallowing example, home.example.com is the ddns address (your house) and example.com is website address pointed to web host provider.

 in the example.com's index.php would contain this:


<?php
 // we define the target in a variable 
 $url = "http://home.example.com";

 //  check if the house computer is on line (Validate this url)
   if (filter_var($url, FILTER_VALIDATE_URL)) {
   // 302 redirect the user to the house (this keeps bots only indexing the example.com address in search engines)   

    header("Location: http://home.example.com"); 

   } else {
 // either continue here within the brackets to form the index page, or redirect to a different page using the header command like the above. 
// this is just a simple hello world index   
?>

   <!DOCTYPE html>
   <html>
   <head>
    <title>Page Title</title>
   </head>
   <body>

   <h1>Hello World!</h1>
   <p>This is a paragraph.</p>

    </body>
   </html>

  <?php

    }

Pretty simple solution.

  • 302 redirects don't always keep content indexed in the desired location. You might be able to use canonical tags some for that, but Google has been ignoring those more recently too. – Stephen Ostermiller May 14 '18 at 20:43
  • If the server that has this PHP code goes down, it won't be able to redirect to the other server. This solution requires 100% up time and availability from that server. – Stephen Ostermiller May 14 '18 at 20:43
  • how often does a hosted website go down? not very often unless you got one of those free hosting that sleeps or puts the web server in standby from time to time....@StephenOstermiller – drtechno May 15 '18 at 12:51
  • If they change the rules with 302 redirects all that needs to be added is the sense for google bot user agent, then pass it to the page instead of redirect. If you really think its important now @StephenOstermiller, I will look up what is needed to revise this answer..., But you could revise it for me since you are probably an educated programmer. I'm an electronics guy by profession, and I am just learning (at an accelerated rate). – drtechno May 15 '18 at 13:08
  • It depends on your goals. If your goal is to use fail over to make your website stable and increase your up-time, this isn't the solution for you. If you want to minimize the amount of data served by your hosted solution and use your home computer whenever it is available, this could work. – Stephen Ostermiller May 15 '18 at 13:12
1

Here's a DIY solution for failover DNS: Install a BIND server on your VPS and host your own DNS nameserver that can respond in a custom way to downtime conditions.

In BIND, set the TTL for your site's DNS records to something low like 5-60 minutes, so that you can fail over quickly. Constantly ping your home server from your VPS. When your home server goes down, set an A record in BIND pointing to your VPS. When your home server comes back up, delete the A record and add a CNAME record pointing to your no-ip hostname.

DNS failover isn't as quick as a real, professional load-balancing VPS failover, but there you have it. For bonus points, cut out the middleman and have your home server post DDNS updates directly to your VPS instead of no-ip.

Guerilla failover DNS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.