W
W
WeReng2016-05-13 17:30:17
Nginx
WeReng, 2016-05-13 17:30:17

How to transfer a site to a new server?

Hello!
There is a site where users leave comments on posts every day, i.e. data is constantly written to the database. The task is to transfer the site from one server to another.
If the site was static, then there would be no issues. We transfer the files and the database to the new server and update the DNS records. Thus, after some time, traffic from the old server will go to the new one, after the DNS is completely updated.
However, I have suspicions that DNS will not be updated for all users at once, so some will go to the old server, and some to the new one. If the database is constantly updated, this cannot be allowed, all visitors should immediately get to the new server.
Therefore, the question is how to make it so that after transferring all the files and the database, users who still get on the old server are automatically redirected to the new one. There are thoughts that it is necessary to register some kind of redirection by ip to a new server in the nginx config, but unfortunately, experience in editing nginx configs is not enough.
What is the correct way to solve my problem?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2016-05-13
@WeReng

If the site is not very serious and the database is small and you don’t want to take a steam bath. Then:
1. We create a database on a new server
2. We upload the engine to a new server
3. We chop off the site for those works and quickly transfer the database via ssh before making a remote connection. and quickly change the config (connection to the database) to a remote connection via IP xxx.xxx.xx.xx:3306
4. Open the site
5. On the new server, only the config where the local connection to the database will go.
6. Add avatar files to music or whatever else you have on the old server in the engine so that they are uploaded asynchronously to both servers!
7. After 3 days, we will probably demolish the old site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question