Sign in Registration
ruen

How to transfer a site to another hosting or tariff yourself remotely, without downloading to a computer

The site may need to be transferred at any time to another tariff or hosting. For this, technical support is often involved, but it may refuse or respond for a long time, not to mention the transfer speed itself. Therefore, you need to perform migration of the site yourself.

kak-samomu-perenesti-sayt-na

To do this, first you need to archive the site files, a ZIP archive will do. You can use hosting tools, or you can use SSH. Creating such an archive is easy, you can use the SSH command:

zip -r archive-name.zip /folder-path

After that, you can download the archive to your PC, but in order not to waste traffic and not wait a long time for downloading, and then uploading to a new hosting, you can use remote transfer from one server to another. There is an SSH command for this:

wget https://example.com/archive.zip

In order to use this command, you need to SSH into the destination host and run it. But first you need to move the resulting archive on the source hosting to the site folder so that you can download it from the URL. For security purposes, it is better to name the archive with a random set of characters so that no one can download your site by accident. As soon as the archive is downloaded, the archive must be immediately removed from the site directory. After that, on the final hosting, you need to unzip:

unzip archive-name.zip

It remains to transfer the database remotely, for this there is the mysqldump utility, the SSH command with archiving:

mysqldump -u username -puserpassword dbname | gzip > path-to-target-file.sql.gz

The password is not indented from the p parameter. After that, the resulting archive is moved to the site folder and downloaded in the same way as site files using the wget utility. It is important to use random names and do not forget to delete the archive in the root of the site after the operation is completed.

Next, the resulting dump is loaded into a new database on the final hosting using the SSH command:

gunzip < path-to-dump-file.sql.gz | mysqldump -u username -puserpassword dbname

It remains only to check the integrity of the files and delete the old hosting service, and update the database connection settings on the new one if necessary. You may also need to transfer the SSL certificate and perform other settings with adding, setting up a domain, etc. It won't take long, you can skip the update of DNS records for the domain and use VPN, for example, in the Opera browser - to quickly check the site's performance on a new hosting.

Comments (0)
For commenting sign in or register.

Latest articles

Popular sections

Communication

Login to the web version
Android app:
Available on Google Play

Share this

Subscribe to

YouTube