Backups Part 1: Creating a Backup of your Web Site

July 21st, 2009 by

I think it is safe to say that the majority of computer users, at one time or another, and to one degree or another, has had that moment where we wished we had made a backup of our files—but hadn’t. I don’t believe that an in-depth explanation is required to illustrate why this is a good idea, and that we can all agree that this is something that we should periodically do to avoid that “I wish I made a backup” moment.

While it may seem obvious that you would do this on your personal computer; the files on your Westhost account are no exception. It is just as easy to remove or overwrite a file or an entire directory on your Westhost account. The frequency in which you do this is going to depend on your site; you must decide on the regularity that you perform the backup. There are multiple ways that you can perform the backup of your site, the easiest and most popular method I will describe below.

Site Backup

Take inventory of your account

This will give you an idea of what you are going to back up if for whatever reason you are unsure. The easiest way to do this is to access your Site Manager ( > Install & Manage Applications. This will give you a snapshot of the applications that you have installed and what you will be backing up.

Install FTP program

You are going to want to install an FTP program on your computer to download the backup that you will create. FTP stands for File Transfer Protocol and is going to be the method with which you download your backup from the Westhost server to your computer. There are many FTP programs out there that you can use ranging from free to programs that you must purchase. For the purposes of this instruction, I will be using FileZilla as it is compatible with both Windows and Mac platforms. You can download FileZilla for free here.

To set up FileZilla, you will want to follow the Westhost documentation that has been provided here. Setup instructions for other FTP programs can also be found in the Westhost documentation.

Zip up site directory

It is possible to download the entire site directory file by file, but this results in long download times and is overall inefficient. The preferred way to back up your site is to “zip up” your site’s home directory into one single zipped file, and then download the one file. To zip up your sites directory follow these steps:

  1. Open up the File Manager ( and log in with your Site Manager username and password
  2. Upon logging in, you will be placed inside your primary domain’s directory (/var/www/html). In order to zip up the /html directory, you will need to go up one directory (/var/www). You can do this by simply clicking “up one dir” at the top of the directory list.
  3. It’s important that you are in this directory; otherwise, the below command will not work. Now that you’re in the appropriate directory, you will issue the zip command by first clicking “Execute a Command” at the top right of the screen.
  4. Type in this command where it says Enter Shell Command:
    tar -zcvf html/
  5. Hit Submit and this will initiate the backup process. This may take a while depending on how big your directory is. So don’t be alarmed if it appears as if it isn’t doing anything. When it is finished it will output a long list of files that it archived.

Download backup

Now that you have successfully zipped your directory backup, you are ready to download it. Open up FileZilla and connect to the server by following the instructions outlined in the Westhost documentation.

When you open up FileZilla, you are going to see a local side (your computer) on the left and a remote side (your server) on the right. By default you will be placed in the upper-most directory on your server “/” or what is known as the root of your server. You will need to browse to the location where the backup was made. On the top-right pane of FileZilla, browse to /var/www and you should see the backup that you created in the bottom-right pane. Simply drag the backup file ( over to the left-hand pane of your FileZilla which is your local computer. This will initiate the download and, once again, can take awhile depending on how large the backup is. The progress meter at the bottom of the screen should give you an idea when the download will be finished.

Database Backup

The backup that we performed is going to back up your Web site’s files, but if your Web site uses applications such as WordPress, Joomla, Drupal, or any other application that delivers dynamic content, you are going to have a database that you will want to backup as well. The databases that these applications use are going to store all of your blog posts, application settings, users, etc. Simply put, applications that use a database will not function without it. That said, it is equally important to back up the database as it is to back up the site files.

You will most likely already know if you have an application that uses a database after taking inventory of your site earlier on step one. If you have determined that you use a database, follow these steps to make a backup of the database. At any rate, it would be a good idea to follow the below steps to be absolutely sure that you’re backing up a database if you have one.

Install phpMyAdmin

phpMyAdmin is a database management application that will allow you to export your database. To install this (if not installed already), go to Site Manager > Install & Manage Applications. phpMyAdmin is going be under the Development sub section and will be highlighted blue if already installed. Once it’s installed, click on the phpMyAdmin name and it will give you a link to the phpMyAdmin login.

Once logged in (you will need to use your Site Manager username and password), you will see the main page for phpMyAdmin. On the left you will see a list of all your databases. From this list, you will be able to identify quite easily databases that your site uses (databases like mysql, test, and information_schema are there by default and generally don’t need to be backed up). To make a backup of each database, you will need to follow the below process.

  1. Click on the database on the left
  2. Click on Export (towards the top)
  3. Scroll down to the bottom and check “Save as file”
  4. Click Go (opens window prompting you choose a location to save the exported database on your computer)

This will export the database in SQL format which is the standard format for databases. Repeat this export for your other databases as necessary.

Once you have made the backup of your site files and the database, you can rest assured that you have something to fall back on if in case, you encounter one of the would-be “I wish I made a backup” moments.

  • Share this post

Improving Apache Web Server Performance

AutoMOD: Customization Magic for phpBB3


# 27th July, 2009

If you’re going to give shell instructions, then you should also add either:

1) for just the foobardatabase
mysqldump foobardatabase | gzip > foobardatabase`date “+%Y-%m-%d”`.sql.gz

2) or for all databases
mysqldump –all-databases | gzip > all`date “+%Y-%m-%d”`.sql.gz

# 27th July, 2009

beware the fancy quotes in the above. also, the m-dash before in #2 is really two hyphens

– – all – databases
but without the spaces

the backtick is really a backtick (over the tab key)

Oregon Wedding Photographer
# 5th August, 2009

Thank you for such a great detailed explanation of how to backup our websites. I have been looking for something like this for some time.

# 5th August, 2009

Two questions:
1. Does WestHost do any regular backups of customer files?
2. Although it’s nice to know how to do manual backups, automatic is always better! Can you step us through how to set up automatic backups, perhaps that get emailed or ftp’d offsite automatically as well?

Chris Olson
# 6th August, 2009

Westhost regularly backs up its standard shared hosting accounts. Only with the dedicated server plans is it an additional option to have Westhost back up your account. We maintain a rolling five-day backup and so we will always have the last five days of backups on your site. There is one caveat to this and that is that this backup is mainly used for technical support reasons and shouldn’t be relied on 100% as your main backup and shouldn’t take the place of your regular backups. But it is nice to have this as a secondary backup if ever needed. If you need us to restore a backup for you, just contact us and we can help you use this backup option.

It’s always nice to know how to do the backup yourself. I also agree that it would be ideal to have this done automatically and stored offsite. Currently there is no automatic backup solution that Westhost offers; however, we will have other backup solutions when we move to Westhost 4.0 in the following months. We currently do not have a date on when that will happen, but we are in alpha testing now.

# 29th August, 2009

Chris Olson has it right. If your web site is important to you then it makes good sense to maintain an off-site copy of it just in case. This advice would apply, no matter where you host your site.

I do all the things mentioned here to back up some sites I have at Westhost plus I also use a Perl script to email the tar.gz files to a mail box not at Westhost. Put all the shell commands in a shell script and execute it from a cron job. You have an automatic back up process.

The script I use is adapted from this:

At the minimum you will need to add a mime type:

$mime_filetype = “application/g-zip” if ( $sendfile_fn =~ /gz$/ );

For a person wanting to learn a little about linux commands and shell scripting, this could be a good starter project. The Westhost Community Forums are full of advice on how to do things like this.

Website Design UK
# 22nd October, 2009

Thanks for a sharing articles.

# 8th December, 2009

i accidentally drop my whole database, c203 in phpmyadmin. help me~ =(

eric marantan
# 22nd February, 2010

hello, I have an existing domain and using a database in my web host. My phpmyadmin is not installed in my cpanel. If I were going to install my phpmyadmin in my cpanel through the one-click install application, does my existing database will affected or it will maybe remove?

I just want to add a subdomain account and it needs a database. If I were going to install my phpmyadmin, is there any changes will happen to my existing database? please help me. i need your suggestion about this.

thank you..

# 26th October, 2011

I’ve been wanting a good backup tutorial for a while… I’ll bookmark this one. Thanks Chris!