By nicholasfc
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!
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;
}
}
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.