Answer the question
In order to leave comments, you need to log in
How to transfer a site to another server?
Good evening.
There is a need to change the server. For some reasons.
Here I ask a question. At the moment, the site is working under a web server (apache), but in the future it will work under (nginx), I'll figure out the configuration, but there is a question about transferring the database to mysql.
I ask for detailed explanations on how this can be done, thanks.
Answer the question
In order to leave comments, you need to log in
You make a backup of the database.
You make a backup of the directory with the site script.
You fill in in the new directory a script on the new server.
Restoring a database backup.
Ready.
mysqldump database > file.sql
Transferring a file to a new server
cat file.sql | mysql new_database
If the database is large, it's better to go to mysql and say use database; source /path/to/file.sql
DATABASE:
1) create a backup on the old server and download it.
2) create a user on the new server (for ease of transfer with the same login and password as on the old server).
3) create an empty database on the new server (with the same name as it was on the old one) (do not forget to set user rights to this database).
4) on the new server, restore data from the backup downloaded in the first paragraph.
SITE CONTENT:
1) copy 1 to 1
After completing these steps, changes in the site files (if required at all) will be minimal.
If the site is not constantly updated, or you can not update troubles for a couple of hours, then the move is quite simple:
Do a database dump (mysqldump) Make a
site archive (tar)
Transfer this data to a new server
Restore the database
Unpack files Make
server settings
Enter the site name in hosts and new ip
Check that everything is correct
Update the dns record to a new ip
After 2 hours, your site in the new location is available around the world, well, or 12, who has what kind of cache :)
If the changes are constant, then the transfer must be done by raising the database replication with the second server but I think it's easier
everything is just so you forgot the most important thing, you need to rewrite .htaccess in nginx
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question