How to do a redirect to another server if the first is unavailable?

Good day!

I ask this question, let's have хостинг1 that is configured for our site, and хостинг2. Initially our domain leads to хостинг1. Is it possible to make it so that if хостинг1 returns "500 Internal Server Error" that happens redirecting to хостинг2, to make your website work with it?

Seems like their server, you can configure fault tolerance by using so-called DNS Failover, but what if you only have virtual hosting? Well, or one shared hosting and VDS?

Thanks in advance!
July 12th 19 at 16:44
2 answers
July 12th 19 at 16:46
Solution
Start the webserver-balanced as only a proxy ( nginx upstream weight ), then for him to have to raise new path.
well, as I understand, this solution requires the server within your local network, and making this has one 2 VDS and shared hosting? - Orlo.Emmeri commented on July 12th 19 at 16:49
VPS deploy nginx with upstream ( IP hosting ) and submit a record in the DNS domain on the IP VDS. nginx.org/ru/docs/http/ngx_http_upstream_module.html - felicita.Keeling65 commented on July 12th 19 at 16:52
July 12th 19 at 16:48

Find more questions by tags System administrationWeb Development