Hosting a website on a DO droplet and Github Pages

January 22, 2015 623 views

Is it possible to have a website hosted on two places (in my case here and github pages) so if one stop working I have the other as a fallback for minimal downtime? Like if I need to change something on my VPS and need it to be offline.

For exemple: If someone access it firsts check to see if the DO one is online, if not, it redirects to the one hosted on github pages.

Do I need load balancing or is there anything easier to setup?

Did I make myself clear? If any other information is needed let me know.

1 Answer

You would need an extra droplet or other server to act as a proxy/load balancer. You can set up a small droplet with nginx and configure it using a configuration like the one below:

upstream lb {

server {
    listen  80;
    server_name localhost;

  location / {
        proxy_pass              http://lb;
        proxy_redirect          off;
        proxy_next_upstream     error timeout invalid_header http_500;
        proxy_connect_timeout   2;
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
Have another answer? Share your knowledge.