Want to reduce the size of your WordPress website backup through compression? Don’t fret—we’ll show you how. We will also mention some benefits of compressing data in case you aren’t convinced. Plus, we urge you to utilize compression to minify your JavaScript, CSS, and HTML code. Additionally, you should delete or replace big files, compress properly sized images and deliver scaled images. All that shrinks your website size, meaning the backup will be lighter, plus boosts the loading speed. Now, here’s how to compress your WordPress website while backing it up.
Why should I compress my WordPress website during backup?
Here are 6 reasons to backup a compressed version of a WordPress website:
- It saves space. Compression reduces the size of your WordPress site files without a change in the way the website looks or functions.
- Compression speeds your website up. It not only decreases the backup size but has a positive effect on your website speed. Gzip compression, minifying JavaScript, HTML, and CSS, uploading images in the correct size and compressed, and other methods drastically increase the loading speed.
- It boosts the backup transfer speed. The lower the backup size, the faster the backup file will be uploaded online or copied to local storage.
- It increases the number of backups at hand. The decreased backup size lets you have a backup of a backup for added safety.
- Compression saves you money on storage. You may realize you’re overpaying for storage capacity after compression. Moreover, you can fit in more backups for the same price.
- It doesn’t require extensive knowledge. Modern types of compression can be enabled manually. Also, optimization, caching, CDN (Content Delivery Network), and backup plugins use it by default.
What should I consider before making manual WordPress backups?
You should consider these three things (at the very least) before you opt for manually backing up your WordPress website:
- You must be diligent. Make manual backups regularly, depending on how frequently you make changes. Alternatively, automate the process by scheduling backups.
- You need to solve the storage problem. Will you upload backups to encrypted cloud storage? Should you save them on an encrypted hard drive? Can you ensure that the backups are not stored in the same location as the website itself, i.e., a separate data center or web hosting? Answer those questions.
- Never forget your WordPress database. The public_html or root folders contain your website source files. However, they all depend on information from the WordPress database you must back up as well.
1. How to compress a WordPress website during a manual backup
Here are three manual backup methods for a WordPress website that support compression:
1. Instructions to backup a WordPress website using a cPanel
cPanel is a Linux-based site and server management platform with a GUI (Graphical User Interface) most web hosting providers use. Follow these steps to use cPanel to compress your WordPress site after backing up:
- After getting the username and password, access the cPanel on your web hosting provider’s website.
- Head to the File Manager option in the “Files” section.
- Find the public_html folder. It may be titled root or have your site name with or without a prefix. It contains all your site files.
- Right-click on the folder and select Compress.
- Choose the Zip Archive option.
- After the public_html.zip file appears at the bottom, right-click it and select the Download option. This folder is a compressed version of your website you can now copy to separate local storage or upload. We recommend password protection and encryption.
Note. Some web hosting providers use a modified version of cPanel, while others have a custom online site and file management utility. In that case, you should contact their Customer Service after checking whether they offer any specific guides.
2. Manually compressing a WordPress site while backing up via FTP or SFTP
An alternative to cPanel is the best FTP (File Transfer Protocol) clients. FTP (File Transfer Protocol) and SFTP (Secure File Transfer Protocol or SSH File Transfer Protocol) transfer data from your device to your website and vice versa. With that said, follow these instructions to use FTP to create a compressed WordPress site backup:
- Decide on a suitable FTP client, install it, and run it.
- Connect to your website using the FTP credentials your web host service provided. Those are the server address and port, your username and password, and optionally an SSH Private Key.
- Find the root or public_html folder in the file tree once again.
- Right-click on it, then select Download. Finally, pick the file type as ZIP archive. When an FTP client doesn’t have that download option, you must compress a file before downloading as in the method above.
- Copy the compressed backup to another local storage or upload it to a cloud storage service for safekeeping.
3. Using SSH for creating website backups
We mention the use of SSH (Secure Shell) to access your website as a reminder it exits. However, it’s drastically less user-friendly and redundant with the two methods above. However, if you have some experience, here’s how downloading website files using SSH works:
- Create a folder on your local storage. Click the file path in the top menu. On Mac, you can leave the folder, right-click on it, then select Show Path Bar. The address bar appears at the bottom. Copy it in both cases.
- Open your SSH terminal and gain access to your website.
- Enter this command:
scp -r username@serveraddress:rootfolder localfolder
- Replace username and serveraddress with your site credentials. Exchange rootfolder with the name of the full path of the root folder, such as webhostingserver1/public_html, and localfolder with the file path you copied in step 1.
- Execute the command from step 1, and the folder will be downloaded to your local storage.
- Compress the folder using a compression algorithm you wish, such as TAR GZ or ZIP, for example:
zip -r site-archive-name.zip folder_file_path
tar -zcvf asite-archive-name.zip folder_file_path
2. Use a WordPress plugin to compress a website while backing up
Although easy, many users fear compressing WordPress websites as part of a manual backup. Therefore, we propose an alternative. Follow these steps to compress your WordPress website using a backup WordPress plugin:
- Install any of the top WordPress backup plugins. Otherwise, check if the one you have supports compression.
- Although we’re not affiliated, we’ll use Backup and Restore WordPress by WPBackItUp for demonstration.
- Click the Backup option under “WP BackItUp” in the left sidebar in the WordPress Admin section.
- Click the Backup button in the first meta box. The premium version lets you schedule backups.
- Wait for the plugin to create a backup of your website. The archive will be compressed by default. Additionally, the plugin makes a backup of your WordPress database and includes it in the archive.
- You’ll see the generated backup after a success message. You can now download, upload, or delete it.
3. How to backup your WordPress database with compression
If you chose the manual method, you must backup your WordPress database too. Refer to the guide for detailed steps. We provided two abbreviated methods of backing up and compressing your WordPress site database:
1. If you use phpMyAdmin for database access
After selecting all tables in the database and clicking Export, make sure to put checkmarks in front of either zipped or gzipped under “Compression” in the “Output” section. The saved database archive backup will be compressed.
2. When you use MariaDB or an alternative database
Run these commands in MariaDB or Straight SQL to make a compressed version of a WP database:
- While creating a backup:
mysqldump -u my_db_user -p my_db_name | bzip2 -c > db_backup_file.sql.bz2
(for bzip2 compression)mysqldump -u my_db_user -p my_db_name | gzip -c > db_backup_file.sql.gz
(for gzip compression).
- After you create a backup:
user@linux:~/save/to/file/path> gzip db_backup_file.sql
(for gzip)user@linux:~/save/to/file/path> bzip2 db_backup_file.sql
(for bzip2 compression)