Answer the question
In order to leave comments, you need to log in
How to make a redirect from one server to another within the same domain?
Hello! Planned to move to another server. Made all the settings, moved all the sites. Now you need to update the DNS records and wait for all traffic to go to the new server, after which the old one can be disabled. However, the question arose, is it possible to somehow immediately redirect users to a new server using nginx, and if so, how? Those. a request came to the old server, and nginx redirected the user to the new one on the same page. What needs to be added to the config for this? I also ask you to help me understand how correct this decision is, I understand that there will be delays, but will it be so critical? The old VPS is located in the data center of Amsterdam, the new one is in Moscow.
Answer the question
In order to leave comments, you need to log in
Some stupidity.
Migrate sites, rewrite DNS.
Once picked up, new users will go to the new server.
Then wait 3 days to reset the DNS cache and you can close the old one.
If a database is used, then on the old server you must also register a call to the new database.
Instead of the usual localhost server, write the IP of the new server, and merge the databases.
Thus, both servers will use the same (new) database.
You must also allow remote connections on the new server.
Why any nginx redirects yet?
You are the third person here with this question in the last couple of months. There are a bunch of methods for doing this.
But I will not tell you - use the search, everything is well chewed in those answers.
What for?
Or have your host addresses changed?
If the hostname did not change, then just rewrite the ip - nicknames in the zone and that's it. Traffic will go to new addresses.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question