Report this

What is the reason for this report?

Hosting a website on a DO droplet and Github Pages

Posted on January 22, 2015

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 example.com 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.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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 server1.com:80;
    server server2.com:80;
}

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;
}
}

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.