Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am about to migrate my web server. I am using Ubuntu Server on both systems. I've never done this and I need to know what I should look out for. Can I just copy the var directory?

I have many webapps. These include Joombla, Wordpress, DotProject, PHP Timeclock, Opendocman, Linpha and many more. What special precautions do I need to take to ensure that everything works properly once migrated?

Also, do I need to import the MySQL databases, or can I just copy everything? If I can copy everything, what directories do I need to copy?

Lastly, how does PHP affect all of this?

Any help would be greatly appreciated. Links with more information would also be appreciated.

share|improve this question
up vote 2 down vote accepted

This does partially depend on what authority you have in both places. Life will be much easier if you can use tools like phpMyAdmin and ssh to move things.

If you are able to mimic the folder structure on the second server you should be fine simply ftping the files from one to the other. If you don't (say, for some reason, you have a custom directory and aren't using /var/www/ as your root, then you should at a minimum test to see if the directory is hard coded somewhere (find /your/dir/ -exec grep /your/dir {} \; -print should do it)). But you also need to make sure that you've chmod'd the files appropriately (a sane default is often chmod -R 644 /path/to/dir (it gives everyone read access while keeping read-write for the file owner), though you might want to use 666 (read-write))

You will need to check to see if your conf files contain anything which is not default. They are in /etc/apache2 by default in Ubuntu. (As per the comment, make sure you copy your php.ini over, and while you're at it, make sure that you have all of the extensions available for PHP and Apache (Apache should raise a red flag if there are extensions missing, with PHP make sure that the outputs of phpinfo() are reasonably comparable))

I, personally, make sure that I've not only copied the data from the database (using mysqldump or the phpMyAdmin export tool), but I make sure that I have the same usernames and passwords (including the apropriate permissions) — sometimes frameworks will hide this information in not-so-obvious places, reproduction of the original environment makes life more tolerable.

If you have mail set up on these servers, that is a whole 'nother can of worms. You'll need to make sure you update your MX records at a minimum.

The best advice I can give, however, is DON'T PULL THE FINAL SWITCH UNTIL YOU HAVE CONFIRMED THAT EVERYTHING WORKS. I recently (accidentally) did not perform a thorough test of my email system and it almost cost me thousands of dollars in lost revenue.

As a side note: often hosting companies will help you transfer data from one domain to another. If this is an option, you may wat to consider it.

share|improve this answer
Also reduce your DNS TTLs to a few seconds, so that when you switch, you switch as cleanly as possible. – Terence Johnson Dec 15 '11 at 20:52
Thanks for the help. – Arthur Dec 15 '11 at 21:50
I would also copy php.ini (and, probably, some other, like php-fpm.conf, if PHP-FPM is used). – minaev Dec 16 '11 at 7:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.