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 another hosting. For this, technical support is often involved, but it can refuse or take a long time to respond, not to mention the transfer speed itself. Therefore, you need to transfer the site yourself .
To do this, first you need to zip the site files, a ZIP archive will do. You can use hosting tools, or you can use SSH . It is easy to create such an archive, you can use the SSH command:
zip -r archive-name.zip / path-to-folder
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 downloading from one server to another. There is an SSH command for this:
wget https://example.com/archive.zip
To use this command, you need to log into the final hosting over SSH and execute it. But first, you need to move the resulting archive on the original hosting to the site folder so that you can download it from the URL. For security reasons, it is better to call the archive 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 zip-name
It remains to transfer the database remotely, for this there is a mysqldump utility, SSH command with archiving:
mysqldump -u username -p user password dbname | gzip & gt; path-to-destination-file.sql.gz
The password is specified without indentation 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 remember to delete the archive at the site root after the operation is completed.
Next, the resulting dump is loaded into a new database on the final hosting using the SSH command:
gunzip & lt; path-to-dump-file.sql.gz | mysqldump -u username -p user password dbname
All that remains is 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 the rest of the settings with adding, configuring the domain, etc. It will not take long, you can not wait for the DNS records for the domain to be updated and use VPN , for example, in the Opera browser - to quickly check the site's performance on the new hosting.
Latest articles
- IT / Misc 08.07.21 How to make a free translation for a website without an API, translate documents in Google Translate
- IT / Misc 06.07.21 How to make a subscription button on a website, a subscriber base and automatic mailing
- Food / Misc 06.07.21 How to quickly cook delicious fried pies with potatoes and onions
- IT / Misc 04.07.21 Caching - create, load and reset. Where to store the cache, methods and types of caching
- IT / Database 03.07.21 Custom NoSQL - storing data in files and not only in a database. Storing settings, small data and caching files