设置和运营WordPress网站的过程可能非常复杂。但是您要做的最后一件事就是停在那里,永远不要备份您的WordPress网站。
随着时间的推移,当您为您的网站开发内容并建立流量时,总是存在服务器问题或黑客攻击导致您的网站瘫痪并可能摧毁您的网站的风险。
备份您的WordPress网站是防止丢失所有内容和投入其中的所有工作的重要保障。在本文中,您将学习如何手动执行WordPress站点的完整备份,以及如何使用最好的WordPress插件进行自动备份。
WordPress 网站备份的组件(Components Of a WordPress Website Backup)
要了解WordPress备份的工作原理,了解需要备份才能恢复的WordPress站点的组件非常重要。(WordPress)
- MySQL 数据库(MySQL Database):此后端数据库包含您网站的帖子内容和配置数据。这是您网站内容的大部分。
- 核心 WordPress 安装(Core WordPress Installation):这些包含包含在您的网站存储在 Web 服务器上的根目录中的大部分文件和文件夹。
- 网站内容(Website Contents):wp-content 目录包含您用于自定义WordPress网站的所有主题和插件文件。
- WordPress 配置(WordPress Configuration):为了正确连接数据库,WordPress需要存储在根目录中 wp-config.php 文件中的数据库登录详细信息。
只要您拥有与您当前在站点上运行的WordPress版本相匹配的核心(WordPress)WordPress安装版本的副本,您就不需要备份核心WordPress文件。
在这种情况下,您只需要备份MySQL 数据库(MySQL Database)、wp-content目录和wp-config.php文件。
如何手动备份您的 WordPress 网站(How to Manually Backup Your WordPress Site)
如果您已经拥有Core WordPress 安装(Core WordPress installation) ZIP文件,那么您可以为您的WordPress站点执行最快的备份类型。
- 要备份您的 WordPress MySQL 数据库(backup your WordPress MySQL Database),请登录 cPanel 并在文件(Files)部分下,选择备份(Backups)。
- 向下滚动到Partial Backups,然后在Download a MySQL Database Backup下,选择要备份的WordPress数据库的链接。(WordPress)
- 您可以将 *.gz 文件保存在计算机上的任何位置。稍后,如果您需要恢复此数据库,您可以返回到 cPanel 上的同一页面。在Restore a MySQL Database下,只需选择Upload按钮并选择您之前下载的 *.gz 文件。
- 要仅下载wp-contents目录和wp-config.php文件,请使用(wp-config.php)您最喜欢的 FTP 工具(your favorite FTP tool)连接到您的虚拟主机帐户。使用您的网络主机提供的FTP登录 ID 和密码进行连接。
- 使用FTP客户端下载整个wp-content文件夹和wp-config.php文件。
注意(Note):如果您确实想对主目录中的所有内容执行完整备份,请在同一 cPanel备份(Backups)页面下的部分备份(Partial Backups)下,您可以选择下载主目录备份下的(Download a Home Directory Backup)下载(Download)按钮,这将下载您的所有文件夹和文件站点的主目录。
使用插件执行自动 WordPress 备份(Perform Automatic WordPress Backups With Plugins)
手动备份既快速又方便,但您需要记住定期进行。如果您忘记进行备份,并且在网站崩溃或感染病毒之前创建了许多新内容,则在恢复上次备份时,您可能会丢失所有这些新内容。
更聪明的解决方案是安装可用于自动化备份过程的众多优秀WordPress插件之一。(WordPress)
有很多很棒的WordPress备份插件可供选择(请参阅本节底部的列表)。下面显示的示例使用UpdraftPlus WordPress 备份插件(UpdraftPlus WordPress backup plugin)。
UpdraftPlus 可让您将WordPress网站备份到任何流行的云服务,如Dropbox、Google Drive、Rackspace Cloud,甚至FTP或电子邮件。
- 要安装UpdraftPlus,只需下载插件文件,并将其(使用FTP客户端)复制到wp-content目录中的plugins文件夹。
- 将文件夹复制到那里后,登录WordPress管理仪表板,导航到Plugins,然后激活UpdraftPlus插件。
- 激活后,您将在“设置”(Settings)菜单中看到UpdraftPlus 备份。(UpdraftPlus Backups)选择它以访问UpdraftPlus仪表板。
- 要设置备份频率,请选择“设置”(Settings)菜单。在这里您可以选择备份WordPress 文件(WordPress Files)(wp-content) 的频率,以及备份WordPress数据库的频率。
- 这也是您选择要用于存储备份的云服务的地方。选择要备份到的云服务后,您需要输入的身份验证信息将显示在同一页面的下方。
- 要查看最近的三个备份,只需选择现有备份(Existing Backups)菜单。
在此页面上,您可以选择蓝色的“恢复”(Restore)按钮以使用当天进行的备份来恢复您的站点。
注意(Note):每次备份WordPress网站时,UpdraftPlus 都会(UpdraftPlus)将三个备份文件存储在您的Google Drive帐户中,并在名称中注明备份日期。这意味着三个新文件会像您执行备份一样频繁地添加到您的帐户中。
因此,请监控您的Google Drive备份文件夹,并确保删除非常旧的备份以节省帐户空间。
除了UpdraftPlus 之外(UpdraftPlus),还有许多优秀的自动WordPress备份插件可供选择。
- Vaultpress:这个插件不是免费的,但价格实惠。除了执行站点的自动备份(最多存储 30 天的备份)之外,它还提供安全扫描以防止黑客或恶意软件(or malware)。
- BackupBuddy:一次性购买BackupBuddy,并在您的站点(或多个站点)上永久使用它。它可以进行自动备份并将它们保存在任何主要的云存储帐户中。它还备份核心WordPress文件,因此在整个网站丢失后不需要重新安装WordPress 。
- BoldGrid Backup:这个WordPress备份插件与其他插件类似,除了它还有一个非常有用的功能,如果(WordPress)WordPress更新失败,它会自动将您的站点回滚到以前的工作备份。
- BackWPup:如果您喜欢免费插件,那么这个插件是UpdraftPlus的一个很好的替代品。此插件将使用预定的WordPress(WordPress)作业执行自动备份到您首选的云帐户之一。它还将检查、优化或修复您的WordPress数据库。
练习您的 WordPress 备份解决方案(Practice Your WordPress Backup Solution)
发现您选择的WordPress备份解决方案实际上并没有按照您预期的方式工作的最糟糕时间是在您的网站崩溃或被黑客入侵之后。
因此,一旦您选择了上述解决方案之一,请练习使用该解决方案对您的WordPress网站进行完整备份。然后,执行完全恢复并确保您的站点仍按要求运行。
在测试任何自动化WordPress插件解决方案之前,请始终使用上述手动过程进行完整的手动WordPress备份。(WordPress)这样,如果插件不起作用或以某种方式损坏了您的站点,您将拥有一个替代备份,您可以使用它来手动恢复您的站点。
How To Backup Your WordPress Site
The process of setting up and operating a WordPress site can be pretty involved. But the last thing уou want to do is stop there and never backup your WordPress site.
Over time, as you develop content for your site and build traffic, there’s always a risk of a server issue or a hacking attack taking down your website and potentially wiping out your site.
Taking a backup of your WordPress site is a critical piece of insurance against losing all of your content and all of the work you put into it. In this article, you’ll learn how to perform a full backup of your WordPress site manually, and how to use the best WordPress plugins for automatic backups.
Components Of a WordPress Website Backup
To understand how a WordPress backup works, it’s important to understand the components of a WordPress site that need to be backed up in order to recover.
- MySQL Database: This backend database contains post content and configuration data for your site. This is the bulk of your website content.
- Core WordPress Installation: These consist of most of the files and folders contained inside the root directory where your website is stored on the web server.
- Website Contents: The wp-content directory contains all of your theme and plugin files that you used to customize your WordPress site.
- WordPress Configuration: To properly connect with your database, WordPress needs the database login details stored in the wp-config.php file stored in your root directory.
So long as you have a copy of the version of the core WordPress installation that matches the version of WordPress you’re currently running on your site, you don’t need to backup the core WordPress files.
In this scenario, you only need to backup your MySQL Database, the wp-content directory, and the wp-config.php file.
How to Manually Backup Your WordPress Site
If you have your Core WordPress installation ZIP file already, then you can perform the fastest type of backup for your WordPress site.
- To backup your WordPress MySQL Database, log into cPanel and under the Files section, select Backups.
- Scroll down to Partial Backups, and under Download a MySQL Database Backup, select the link for the WordPress database you want to backup.
- You can save the *.gz file anywhere on your computer. Later, if you ever need to restore this database, you can return to the same page on cPanel. Under Restore a MySQL Database, just select the Upload button and select the *.gz file you previously downloaded.
- To download only the wp-contents directory and the wp-config.php file, connect to your web hosting account using your favorite FTP tool. Use the FTP login ID and password provided by your web host to connect.
- Use the FTP client to download the entire wp-content folder and the wp-config.php file.
Note: If you do want to perform a full backup of everything in your home directory, on the same cPanel Backups page under Partial Backups, you can select the Download button under Download a Home Directory Backup and this will download all folders and files in your site’s home directory.
Perform Automatic WordPress Backups With Plugins
Manual backups are fast and convenient, but you need to remember to do them on a regular interval. If you forget to take a backup and you’ve created a lot of new content before your website crashes or gets infected with a virus, you could potentially lose all of that new content when you recover your last backup.
A smarter solution is to install one of the many excellent WordPress plugins that are available to automate the backup process.
There are a lot of great WordPress backup plugins to choose from (see the list at the bottom of this section). The example shown below uses the UpdraftPlus WordPress backup plugin.
UpdraftPlus lets you backup your WordPress site to any popular cloud services like Dropbox, Google Drive, Rackspace Cloud, or even FTP or email.
- To install UpdraftPlus, just download the plugin files, and copy it (using the FTP client) to the plugins folder in your wp-content directory.
- Once you’ve copied the folder there, log into your WordPress admin dashboard, navigate to Plugins, and activate the UpdraftPlus plugin.
- Once activated, you’ll see UpdraftPlus Backups listed in the Settings menu. Select it to visit the UpdraftPlus dashboard.
- To set up the frequency of your backups, select the Settings menu. Here you can select how frequently to backup the WordPress Files (wp-content), and how frequently to backup the WordPress database.
- This is also where you select the cloud service you want to use to store your backups. Once you select the cloud service you want to backup to, the authentication information you need to enter will appear below in the same page.
- To see the last three most recent backups, just select the Existing Backups menu.
On this page, you can select the blue Restore button to restore your site using the backup that was taken on that day.
Note: Every time you backup your WordPress site, UpdraftPlus stores the three backup files in your Google Drive account with the date of the backup in the name. This means three new files are added to your account as frequently as you perform backups.
So monitor your Google Drive backup folder and make sure to delete very old backups to conserve account space.
In addition to UpdraftPlus, there are a number of excellent automatic WordPress backup plugins to choose from.
- Vaultpress: This plug isn’t free, but it is affordable. On top of performing automatic backups of your site (storing up to 30 days of backups), it also provides security scanning to protect against hackers or malware.
- BackupBuddy: Buy BackupBuddy with a one time purchase, and use it on your site (or sites) forever. It can take automatic backups and save them in any major cloud storage account. It also backups up the core WordPress files so reinstalling WordPress isn’t required after a full website loss.
- BoldGrid Backup: This WordPress backup plugin is similar to others, except that it also has a very useful feature that automatically rolls back your site to the previous working backup if a WordPress update fails.
- BackWPup: If you’re all about free plugins, this one is a good alternative to UpdraftPlus. This plugin will perform automated backups using scheduled WordPress job to one of your preferred cloud accounts. It will also check, optimize, or repair your WordPress database.
Practice Your WordPress Backup Solution
The worst time to discover that your chosen WordPress backup solution doesn’t actually work the way you expected it to is after your site has crashed or is hacked.
So, once you choose one of the solutions above, practice taking a full backup of your WordPress site using that solution. Then, perform a full recovery and ensure your site still works as required.
Before you test any of the automated WordPress plugin solutions, always do a full manual WordPress backup using the manual procedure described above. This way if the plugin doesn’t work or somehow corrupts your site, you’ll have an alternative backup that you can use to manually recover your site.