Backup your web site
If something were to happen to your web server right now, how long would it take you to restore all files and all functionality to your site? Maybe your web hosting plan includes daily backups, so why worry? There are many reasons to worry, and a little bit of proactive worry is in this case good.
When was the last time that you actually tested the backup and restore function offered by your web host? Assuming that this checks out ok, there are other reasons why you may need to quickly restore your web site to a different location: a billing dispute with your current web host, spam complaints against your server, copyright infringements on your site. (If you are guilty of sending spam and using copyrighted material without permission, you certainly deserve to lose your site. But even allegations against an innocent may lead you to lose control of your site during the investigation.) The hosting company may also simply go out of business. The ways you can lose your web site are many and unpredictable.
There are several parts to a complete backup of your web site:
1. All the files on the web server
This one is the easiest. Just use your favorite ftp program and copy all the files in the web server root directory (httpdocs or public_html depending on your control panel) and all subdirectories to your PC. Do it right now.
2. Any software you have installed
If you have installed WordPress, a forum, a shopping cart or any other software that did not come with your hosting plan, make sure you have a backup copy of that software and the accompanying installation instructions. Don’t rely on the software vendor to be able to provide you with the exact old version of their software that you have installed. (When you need to quickly restore your web site is not a good time to upgrade software components. You have enough things to worry about as it is.)
It is also better to have the original installation files and reinstall them from scratch, rather than to rely on finding all the necessary installed files scattered on the web server file system.
Don’t forget to keep notes of all configuration changes you make to your web site. This includes DNS settings, Apache configuration changes, and anything you setup in your control panel.
It is difficult to automate backups of configurations since you typically don’t have ready access to where the settings are saved. I just keep a text file on my PC where I make running notes as I make configuration changes to my sites. One text file per web server.
Backing up databases can be tricky. I’ll cover this topic in a subsequent post.
Any backup system is worthless if you cannot restore your data. (Actually it’s worse than worthless: you’ve wasted time backing up data and you’ve been lulled into a false sense of security.) The time to test if you can restore your data is not after disaster strikes. Make sure that you test your procedures before you need to rely on them.
A simple (but not complete) check is to restore all the files to a different subdirectory. Create a new “restore” directory and try to restore all files there. Then compare the contents of the files with the originals. You probably cannot “run” your web site from this restore directory but at least you have verified that your backup does contain valid data and that you are able to restore it.
A more complete test would involve getting a separate web server to restore your files to. This can be a cheap shared hosting plan as long as it has the same software installed as your regular web server. If you are able to restore all your data and create a functional web site on this new web server, then you are in good shape. Repeat this exercise on a regular basis. If you have outsourced your web master tasks then this is a good exercise to ensure that the outsourced resource fully understands your site and your systems.
Keeping this second web site online and regularly updated using the procedures above makes it a disaster recovery site. Many large corporations have such a site available and ready to switch over to should disaster strike the main site. All you have to do is change the DNS settings to point to this site instead of the original site and you’re back in business while you work on restoring the main site. Even if the disaster recover site is not quite up-to-date it is still probably better than having no site at all.
What are some tools and techniques that you use to backup your web server?
Video Tutorial: Backup your WordPress Blog
Should You Upgrade to WordPress 2.5?