How to backup your websites

Background

Your webiste’s components

Your site is composed with code files (HTML, PHP ..etc) which are served by the hosting’s services and computed/displayed by the visitor’s web browser in the end; Downloading these files allows you to have a copy of your site you can restore in case of problems or move on another server.

If you’re using a CMS like Wordpress, your webiste has two main components : files located in the root directory on the hosting and the database.

The different ways

  • an SFTP connection : you connect using a dedicated sotfware handling the SFTP protocol and download the files

  • your PHPMyAdmin interface : there you can export your databae (and import when the time is for restoration)

  • possibly a backup plugin, on Wordpres (or other CMS too) : which creates a bundle with files and database

Backup the files : the SFTP connection

You will find all your connection information on your hosting’s configuration page, on the ‘general’ tab. From your Gandi customer’s interface, go on ‘Web Hosting’ in the left menu, then click on your hosting’s name;

How to connect :

First of all, you need a software with SFTP capacities, like the following free ones :

  • FileZilla client (Windows, MacOS, Linux) :

https://filezilla-project.org/download.php

  • WinSCP (Windows) :

https://winscp.net/eng/download.php

  • CyberDuck (MacOS, Windows) :

https://cyberduck.io/download/

Connection settings :

Here is the link to our documentation : https://docs.gandi.net/en/web_hosting/connection/sftp.html

Files location :

Your files are in your website’s root directory : once connected go in the folder ‘lamp0’, then ‘web’, ‘vhosts’ then you website’s name : you can there download the whole ‘htdocs’ subdirectory. Here is the path, where ‘wwww.yourwebsite.com’ is to be replaced with your real website’s name

/lamp0/web/vhosts/wwww.yourwebsite.com/htdocs/

Backup the database : the PHPMyAdmin connection

It’s an opensource graphical interface widely used to manage MySQL : https://www.phpmyadmin.net/

It’s not directly reachable on your hosting, for security purpose; that’s why the access has to be made in two steps

Connection :

  • at first connect on your control panel : you’ll know the URL from your hosting’s configuration page, below the SFTP settings. The same credentials are required.

  • second, click on the ‘phpmyadmin’ link in the ‘MySQL’ paragraph, and authenticate with the user ‘root’ without password (by default)

Here is the link to our documentation : https://docs.gandi.net/en/web_hosting/database_management/mysql.html#how-to-use-phpmyadmin-to-manage-your-database

Understanding the inferface :

You’ll see two main panels : on the vertical left one, you have all the databases. In the right panel, you’ll have details and tab corresponding to the menu.

On the left panel you can ignore the databases named ‘default_db’, ‘information_schema’, ‘mysql’, ‘performance_schema’ et ‘sys’ : they belong to the system and don’t contain your data. For an automatically installed Wordpress the database will have a name based on this syntax : ‘10 numbers_website name’

Do the export :

  • in the left panel, select your database by clicking on it : you’ll see all its tables listed in the right panel

  • click on the tab ‘export’ in the top of the page

Note

With default option, the export will be downloaded through your web browser. However, if your database is too big, it may fail. In this case you’ll have to choose the second ‘output’ option and save the file in the ‘/srv/data/tmp’ folder. Once done, you can connect using SFTP (cf. first part of this page).

You’ll find the file (.sql extension) in the folder :

/lamp0/tmp/

Using a plugin to create an archive (Wordpress) :

This section is Wordpress specific, but you can find same tools for other CMS possibly.

Gandi doesn’t have any preference about the plugin; you’ll find a non exhaustive list. The principle is as follow : you install the plugin, do the export, and need to install the same plugin on a new Wordpress installation where you want to restore, to import the archive.

Warning

If you website is big, the archive creation and the download from your web browser wiil fail (as well as for the restoration). It’s not possible to overwrite the PHP post_max_size, ou upload_max_max_filesize set to 128MB; in this case you’ll need to create the archive on the server’s disk, and download it after using SFTP. !! Check if the plugin allows it

UpdraftPlus : https://fr.wordpress.org/plugins/updraftplus/

WordPress Backup & Migration : https://fr.wordpress.org/plugins/wp-migration-duplicator/

WPvivid Backup Plugin : https://wordpress.org/plugins/wpvivid-backuprestore/

Duplicator : https://wordpress.org/plugins/duplicator/

BackupWP : https://wordpress.org/plugins/backwpup/

BackUp and Restore WordPress : https://wordpress.org/plugins/wp-backitup/

Premium :

Formerly Backup Buddy : https://solidwp.com/backups/