Cookie

Caution


This article was published more than a year ago, there may have been developments.
Please take this into account.

It sometimes happens that the hoster of confidence, that to which we have entrusted the management of that site, decides to close its doors, or radically change the conditions of the hosting plan.

In these cases there is little to do. One solution is to change hoster. In this article we take care of keeping the Apache settings exactly as they were set on the old server. You must have SSH access to the machines.

1_ We copy the Apache configuration files:

# ssh username@oldserver
# scp /etc/apache2/sites-available/ user@newserver:/etc/apache2/sites-available/

This command will copy the Apache settings from the old to the new machine. Now we enable all the sites copied with symbolic links for each file .config copied to sites-enabled.

# ln -s /etc/apache2/sites-available/yourwebsite.com.conf /etc/apache2/sites-enabled/yourwebsite.com.conf

Or use the command a2ensite that will do the same thing.

a2ensite yourwebsite.com

We restart Apache for the changes to take effect.

/etc/init.d/apache2 restart

2_ We copy the site

# scp -r /var/www/ username@newserver:/var / www

All major CMS (or maybe all CMS) they are made from files, and with this command we copied them all. It must be said that the content, comments, site categories and settings are saved separately in a database. So let's copy that too.

3_ We migrate MySQL

We will run these commands being logged into the old server.

# mysqldump --all-databases -u root -p > backup.sql
# scp backup.sql username@newserver:/home/username/
# ssh username@newserver
# mysql-u root-p < backup.sql

What we did here was to create a backup of the database on the old server, transfer it to the new one and populate the new database with the contents of the old one.

  Worth1000: a site for creative

4_ DNS migration

All that remains is to reset the DNS so that they point to the IP of the new server. This operation is to be agreed with the hoster.

A word of advice. Before making everything operational, it is advisable to test the success of the operations, for example in a subdomain: test.yourwebsite.com, to make sure everything works.


TheJoe

I keep this blog as a hobby by 2009. I am passionate about graphic, technology, software Open Source. Among my articles will be easy to find music, and some personal thoughts, but I prefer the direct line of the blog mainly to technology. For more information contact me.

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.