Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Apache — cPanel & WHM uses the Apache configuration to host websites.

    Note
    titleNotes:
    • The Apache configuration also contains the system's ModSecurity™ configuration. Apache uses ModSecurity to provide intrusion detection and prevention on your web server.
    • For more information about Apache backups, restoration, and transfers, read the More about Apache configurations section below.


  • Backups — cPanel & WHM uses the backups configuration as the system's primary back up and restore tool.

    Note
    titleNote:

    The backup configuration does not include legacy backup configurations.


  • cPanel themes — cPanel & WHM uses the cPanel theme configuration in order to generate the cPanel and WHM interfaces.
  • Exim — cPanel & WHM uses Exim as the system's main mail transfer agent.

  • MySQL® — cPanel & WHM uses the MySQL configuration as the system's primary operations tool.

    Note
    titleNote:

    WHM's Transfer Tool interface (Home >> Transfers >> Transfer Tool) does not allow you to back up, restore, or transfer MySQL configurations. You must use this script to perform these actions.


  • WHM (whmconf) — cPanel & WHM uses the whmconf configuration to back up and restore WHM's common non-user-specific settings (for example, the settings from WHM's Tweak Settings interface (Home >> Server Configuration >> Tweak Settings) and WHM's Basic WebHost Manager Setup interface (Home >> Server Configuration >> Basic WebHost Manager Setup)). 

...

ArgumentDescriptionExample
--restore

Restore a backup file. For more information, read the Restore a configuration section below.

 


Code Block
languagetext
--restore=/home/whm-config-backup-all-1.1-1411229033.tar.gz 


--backup

Generate a backup file. For more information, read the Back up a configuration section below.

 


Code Block
languagebash
--modules=cpanel::smtp::exim --backup

 

 

--list-modulesList the available modules on your server.

The output will resemble the following example:

Code Block
languagetext
linenumberstrue
cpanel::smtp::exim
cpanel::system::backups
cpanel::system::mysql
cpanel::system::whmconf
cpanel::easy::apache
cpanel::ui::themes


--modules

A comma-separated list of the modules to restore or back up.

Note
titleNote:

You can pass this argument with the --restore and --backup arguments to restore or backup specific modules.



Code Block
languagetext
--modules=cpanel::smtp::exim --backup


...

  1. Log in via SSH as the root user and navigate to the /usr/local/cpanel directory.
  2. To list available configurations, run the following command:

    Code Block
    languagebash
    bin/cpconftool --list-modules

    The system will display a list of available configurations. For example:

    Code Block
    languagebash
    linenumberstrue
    cpanel::ui::themes
    cpanel::easy::apache
    cpanel::system::backups
    cpanel::system::mysql
    cpanel::system::whmconf
    cpanel::smtp::exim


  3. Run the following command to back up the configuration, where configuration::to::backup represents the configuration name:

    Code Block
    languagebash
    bin/cpconftool --backup --modules=configuration::to::backup

    The system will display a confirmation message that resembles the following example:

    Code Block
    languagebash
    linenumberstrue
    Backup Successful
    /home/whm-config-backup-configuration__to__backup-10.550000-1452006507.tar.gz


    Note
    titleNote:

    The system will generate a unique backup filename. In this example, the system generated the backup as the whm-config-backup-configuration__to__backup-10.550000-1452006507.tar.gz file.


Configuration backup contents

...

Expand
titleWHM (whmconf) configuration...


Code Block
languagetext
linenumberstrue
/etc/cpupdate.conf
/etc/wwwacct.conf
/etc/wwwacct.conf.shadow
/etc/stats.conf
/var/cpanel/cpanel.config




Note
titleNote:

Each file that this section lists will only exist when the configuration requires it.


Anchor
Restore
Restore
Restore a configuration


Warning
titleImportant:

When you restore an EasyApache 4 configuration backup with the /usr/local/cpanel/bin/cpconftool script, it removes Apache's default include files. If Apache fails to start, run the /scripts/rebuildhttpdconf script and restart Apache.

To restore a configuration from a backup file, run the following command, where backup.tar.gz represents the path to the desired backup file and config::to::restore represents the configuration to restore:

...

Code Block
languagebash
bin/cpconftool --restore=backup.tar.gz --modules=config::to::restore --prerestore_backup



Note
titleNotes:
  • The --prerestore_backup parameter is optional, and causes the system to restore the original version of the file.
  • The --prerestore_backup parameter is always active for Apache restorations, and allows you to troubleshoot your system if an Apache configuration fails to restore.

When you restore a configuration, the following actions occur:

...

  1. The system restores all of the configuration files. 

    Note
    titleNote:
    • If one of the configuration files exists on the destination server but does not exist on the origin server, the system removes that file.


  2. The /usr/local/cpanel/bin/cpconftool script tests whether the configuration is valid.
  3. The /usr/local/cpanel/bin/cpconftool script runs the /scripts/buildeximconf script. 
    • If the test fails, the system reverts the changes. 
    • If the test succeeds, the system restarts the configuration.

...

  • The system moves the /var/cpanel/secdatadir file to the same location on the destination server.
  • The system moves the /var/cpanel/modecmodsec_cpanel_conf_datastore file to the same location on the destination server.
  • The system determines the ModSecurity™ Vendors configurations on your server, along with the inactive or active rules set on your system, and moves them to the destination server.
  • The system determines the ModSecurity configurations on your server and then moves them to the destination server.

...