How to backup your website in the cPanel
  John Mwaniki /   21 Aug 2021

How to backup your website in the cPanel

Anything may happen anytime unexpectedly that negatively impacts your website accessibility or its performance.

Such may be:

  • The server in which the site is hosted may crash and cause loss of data.
  • You or someone with access to your hosting account may accidentally delete some website files or database tables or records.
  • A hacker may infect your website files with malware or delete some data.
  • Some bugs may be introduced during website updates thus causing some errors on the website.

If any of the scenarios above happens to your website when you don't have a backup of your site it can be so traumatizing and cost you dearly including losing your website content/data forever.

What is backup?

A website backup is a copy of all the important website components. These components include files such as code files(html,css,js etc), images and databases

To be on the safer side, it is a good practice to always do regular backups of your website to have the most recent restore point in case anything happens.

Backups are much more important when you create data online rather than uploading content from your local storage.

Doing the backup manually

This is backing up your website files and databases without help of automation tools.

Backing up your website files:

Step 1: Login to your cPanel dashboard.

Step 2: Click “File Manager” under Files section

cpanel file manager

Step 3: Right-click on the public_html folder then click on the “Compress” option as shown below. An alternative way is to select the folder then click on the "Compress" at the top menu.
If your domain name has subdomains whose directory is outside of public_html folder, select them as well then compress (You can backup the subdomains separately as per your wish).

Step 4: The compressed file will be .zip by default. Enter your preferred zip file name and click “Compress File(s)”. It is a good practice to add the current date to the file name as it will easily help you remember the specific date on which the backup was done.

backing up website files

It will show a dialog “Creating Archive” indicating the compression process. Once the compression is over, it will show “Compression Results”. Click "Close".

Step 5: Locate your newly create .zip file, right-click on it and choose “Download” option to download and save it in your local device storage. You can alternatively select the compressed file(s) and click on “Download” at the top menu.

Downloading site zipped backup file

Backing up your database:

Step 1: Log in to your cPanel

Step 2: Click on “PhpMyAdmin” under the Databases section

cpanel phpmyadmin

Step 3: Open the database you want to backup by using the links on the left side of the window then click onExportat the top.

Exporting database in cpanel

Step 5: By default, “Quick” export method and “SQL” format are selected. Click “Go”.

Phpmyadmin mysql database export options

The database .sql file will be saved in your local storage.

Using backup and backup wizard options

Backup option

This option allows you to do a full or partial backup of your site and allows you to save the backup on your computer. It also allows you to do website restoration.

Step 1: Log in to your cPanel

Step 2: Click on “Backup” under the Files section

Cpanel backup link

Step 3: Click “Download a full account backup

Download full website backup

Step 4: Under generate a full account backup, the “Home Directory” option is selected by default. Leave as it is.

If you would like to get notified via email when the backup is over, check the email address option and enter your preferred email address to receive the email. Else if you don't want to receive a notification, check the “Do not send email notification” option.

Click “Generate backup”.

Generating website backup

You will to a page showing a backup progress alert message.

Site backup progress alert

If you chose the option of getting notified when the backup is done, check your email after some time. Else, give it some time and click “back”. You will view your archived backup files under “Backups Available for Download”.

Click on the backup file to download it.

Archived site backup in cpanel

An alternative way of downloading the backup is by navigating to the root directory of cPanel File Manager. Right-click on the backup file and click on the "Download" from the options.

Downloading website backup from cpanel filemanager

Unzip the downloaded backup file.

It contains so many files but you don't need them all. To locate your website files, open “homedir” folder then while within it open “public_html”.

Unzipped/extracted website backup folder

To locate your databases, open the “mysql” folder.

Website backup mysql folder

 

Backup wizard option

The option allows doing either the full or partial backup.

The full backup option allows you to create an archive of all the files and configurations on your website.

The partial backup option enables you to select which partial backup you want to download eg. home directory, databases, or email forwarders and filters.

Step 1: Log in to your cPanel.

Step 2: Click on “Backup Wizard” under the Files section

Cpanel backup wizard

Step 3: Click “Backup” then “Home Directory

cPanel home directory backup

Step 4: Click “Home Directory” again and save the archived file in your local storage.

downloading cPanel home directory

To download databases, click on “MySQL Databases”.

Downloading database backup in cpanel

The databases will be listed down.

Click on the name of the database you want to backup and save it in your local storage.

Step 5: Uncompress the downloaded home directory backup file on your computer and navigate to “public_html” to access your website files.

Conclusion

Anything anytime can happen, which can lead to the loss of your website files or important data. Prevention is always better than cure. Make it a habit to be backing up your website regularly just in case anything happens you may have a restore point.

In this article, you have learned what website backup is, why it is important and how you can do it in your web hosting cPanel.