/usr/local/cpanel/bin/cpconftool script to back up and restore configuration settings. The script groups the configuration settings for different services into modules. You can use this script to back up and restore the following modules:
Apache — cPanel & WHM uses Apache to host websites.
- The Apache module also modifies the servers' ModSecurity™ settings. Apache uses ModSecurity to provide intrusion detection and prevention on your web server.
- The Apache backup, restoration, and transfer processes differ from other modules. For more information, read the Apache module differences section below.
AutoSSL — The AutoSSL feature automatically issues free, Domain-Validated SSL certificates to users' domains.
Backups — cPanel & WHM uses backups to copy or archive data. You can use this data to recover to a previous state.
The backup module does not include legacy backup settings.
- cPanel themes — cPanel & WHM uses cPanel themes to generate the cPanel and the WHM interfaces.
cPHulk — The cPHulk service helps to protect your server against brute force attacks.
- The script does not copy history reports.
- The script appends whitelist- and blacklist-management configuration settings. It does not replace these configuration settings.
Exim — cPanel & WHM uses Exim as the server's main mail transfer agent.
- Greylisting — The Greylisting feature defends email users against spam.
- ModSecurity — This open-source web application firewall helps to detect and prevent intrusion. For more information, read our ModSecurity documentation.
MySQL® — cPanel & WHM uses MySQL as the server's database management.
WHM's Transfer Tool interface (WHM >> Home >> Transfers >> Transfer Tool) does not allow you to back up, restore, or transfer MySQL settings. You must use this script to perform these actions.
- WHM (
whmconf) — cPanel & WHM uses the
whmconfservice to back up and restore WHM's common settings that aren't user-specific. For example, the settings from:
To use this script, run the following command as the
You can rename a backup file. The --
restore and --
prerestore_backup options do not rely on the file's name. You could include modules in the filename, for example.
A comma-separated list of the modules to restore or back up.
The Apache module also contains some ModSecurity settings. Use the ModSecurity module to affect only the ModSecurity settings.
Generate a backup file. For more information, read the Back up a configuration module section below.
Restore from a backup file. For more information, read the Restore configuration settings section below.
List the available modules on your server.
You do not need to include the
The output will resemble the following example:
|List information about the version of the module.|
Display details about the operation that the script performs.
You can only pass this option with the
Restore the original version of the file. The script creates a backup before it restores the module.
Back up a configuration module
To back up a configuration module, perform the following steps:
- Log in to the server as the
rootuser via SSH.
- Navigate to the
To list available configuration modules, run the following command:
The script will display a list of available configuration modules. For example:
To back up the configuration module, run the following command. In the following example,
configuration::to::backuprepresents the configuration module name:
The script will display a confirmation message that resembles the following example:
The script will generate a unique backup filename. In this example, the script generated the backup as the
Restore configuration settings
The Apache configurations may require additional steps. For more details, see the Apache module differences section below.
/home/backup.tar.gzrepresents the full path to the desired backup file and
config::to::restorerepresents the module to restore:
When you restore a configuration module, the following actions occur:
The script restores all of the configuration files.
The script removes any configuration files on the destination server that did not exist the source server.
/usr/local/cpanel/bin/cpconftoolscript tests whether the configuration settings are valid.
/usr/local/cpanel/bin/cpconftoolscript runs the
- If the test fails, the script reverts the changes.
- If the test succeeds, the script restarts the service.
The restoration process returns output that resembles the following example:
Transfer configuration settings
If you use this script to transfer configuration settings, you may encounter undesired behavior. Instead, we strongly recommend that you use WHM's Transfer Tool interface (WHM >> Home >> Transfers >> Transfer Tool).
To transfer configuration settings, perform the following steps:
Perform the backup process for the configuration module on the source server.
- Copy the
.tar.gzfile from the previous step from the source server to the destination server.
- Perform the restoration process for the configuration module on the destination server.
Apache module differences
When you restore the Apache module, the
/usr/local/cpanel/bin/cpconftool script removes Apache's default include files. If Apache fails to start, run the
/usr/local/cpanel/scripts/rebuildhttpdconf script and restart Apache. For more information, run the following command:
To restore configuration settings from a backup file, run the following command. In the following example,
/home/backup.tar.gz represents the full path to the desired backup file:
The script performs the following tasks:
- The script moves the
/var/cpanel/secdatadirfile to the same location on the destination server.
- The script moves the
/var/cpanel/modsec_cpanel_conf_datastorefile to the same location on the destination server.
- The script determines the ModSecurity Vendors configuration settings on your server.
- The script then determines the active or inactive rules that you set on your script.
- The script moves the ModSecurity configuration settings to the destination server.
The script does not perform the following tasks:
- The script does not move the
modsec2.cpanel.conffiles. Any differences in Apache configurations could cause Apache to fail to restart.
- The script modifies the ModSecurity settings in the current
modsec2.*.conffiles but does not replace them.
If the user has control of the
modsec2.user.conffile, the script archives this file. The script also archives any file the
modsec2.user.confconfiguration file includes.
We strongly recommend that you do not manually extract these files.