Answer the question
In order to leave comments, you need to log in
Site on home server and VPS at the same time. How to set up such a link?
There is an idea to place the site on a home hosting. I want to set up the system in such a way that in case of problems on the home server, all requests are sent to a copy of the site on the VPS server. The remote server will be a backup server at the same time. The home computer and the server will be synchronized every day. I'm going to use nginx.
Is such a scheme possible?
Answer the question
In order to leave comments, you need to log in
Yes, you can. On the hosting, you set up nginx, which sends all requests to the home server, and in case of problems, redirects to the local one on the VPS.
In the example below, all requests will go to my_home_ip_address, after three errors there will be a redirect to 127.0.0.1:8080 within 30 seconds. Then again there will be an attempt to reach my_home_ip_address.
upstream backend {
server my_home_ip_address max_fails=3 fail_timeout=30s;
server 127.0.0.1:8080 backup;
}
server {
...
location /http/ {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
...
}
}
I want to configure the system in such a way that in case of problems on the home server, all requests are sent to a copy of the site on the VPS server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question