How to backup a WordPress site on your VPSIn this guide we are going to teach you how to manually backup your WordPress site on your VPS. We highly recommend that you have regular backups of your WordPress site so that you may easily restore it if something unusual happens. For example, if your site is broken because of a faulty plugin then it can get infected with malicious files or you might delete contents of the database accidentally, or various others. In order to make a complete backup of your WordPress site, you have to create a backup of your WordPress files and your WordPress database. WordPress Files For starters, you have to create a backup that includes all of your WordPress site files. In order for this to be done, you have to log into your VPS via SSH. After you have logged in, you must navigate to your WordPress root directory. Depending on your server’s configuration this might be at another location, for example, ‘/var/www/html/wordpress/‘. Your WordPress site has the following files:
- the WordPress core installation files which are stored in the wp-admin directory.
- the WordPress Themes and Plugins which are stored in the wp-content directory.
- libraries and third-party components which are stored in the wp-includes directory.
- Images and Files
- Additional files and static web page
tar -cpzf wp-backup.tar.gz /var/www/html/wordpress/This should make an archive file of every WordPress file which generates your website. WordPress Database Your WordPress files by themselves are not enough if you would like a complete backup of the site. Every piece of information on the site, including your posts, comments, site configurations, user accounts, and so on are located in your database. In order to create a backup of the WordPress database, we will need to execute the command below:
mysqldump -u wp_user -p wp_database > wp_database_backup.sql‘wp_user’ is going to be the name of the user of your WordPress database and ‘wp_database’ is the name of your database. If you are not sure of the user, database name, and password for your website then you may find that information in the ‘wp-config.php’ file which is located in your WordPress folder. With this, you will have everything you require to successfully restore your WordPress site. Once you have successfully made a backup of both your WordPress files and database, you can transfer them to your local computer via FTP; you can also do this the other way around when you need to restore your website.
Updated on 06 Mar 2018
Add a comment