CentOS 8.x Control Web panel Migrate web and email domain from existing server

From Notes_Wiki

Home > CentOS > CentOS 8.x > CentOS 8.x email servers > CentOS 8.x Control Web panel > Migrate web and email domain from existing server

Control Web Panel (CWP) is suited for email and web virtual hosting. Creating a greenfield domain should be straight forward. However, if you want to migrate existing site and emails to CWP based server use following steps.

Creating account

To create account which will maange the domain use:

  1. Go to User accounts -> New account
  2. Enter various details such as domain name, Username, etc.
    Package can be default
    Disable backup of user account
    Optionally enable "AutoSSL: Domain must be pointed to the server"
    Under Packages -> Packages, we can see and create different packages as per requirement.
  3. Note down the Account details shown on next page
    Note that main domains are not listed on domains -> List domains page. They are part of Accounts -> List Accounts page
  4. Open the CWP panel for newly created user in new browser tab. https://<fqdn>:2083/
  5. Go to "Email Accounts" -> "Add a new mailbox"
    Enter the desired password and click Add
  6. Go to "Email Accounts" -> "Roundcube wemail"
    We can access the email via https://<FQDN>:2031/roundcube/
    Login with full email ID and password of user created above


Migrate website

  1. Login to CWP server using SSH
  2. Go to /home/<user>/public_html
  3. Rename index.html to index.html-old and create a new index.html file
  4. Create /etc/hosts entry to point <domain> and www.<domain> to the CWP public IP
  5. Open http://<domain> and validate that new index.html page is showing up properly
    No need to add www.<domain> Subdomain. That is done by default.
  6. Open http://www.<domain> and validate that new index.html page is showing up properly
  7. Copy old domain web-root data to new server /home/<user>/public_html and check if site is working properly. For old document root execute
    rsync -vtrp --delete ./ root@<fqdn>:/home/<user>/public_html/
  8. SSH to CWP server and set correct owner:
    cd /home/<user>/public_html
    chown -R <user>:<user> .
    chmod -R g-w .
  9. If the site is still not opening then via CWP of <user> go to "File management" -> "Log viewer" and look at "Error Log" for the domain or subdomain


General SSL and redirect from http to https

  1. If site opens properly continue by
    1. Comment /etc/host entries created earlier
    2. Change public dns of <domain> to point to shared public IP of CWP server.
      Update only A record. Note that CWP does not supports AAAA properly.
    3. Go to CWP of root. Go to "Webserver Settings" -> "SSL certificates". Go to "AutoSSL (FREE)" tab. Select <user> and select "All Domains". Click "Install SSL"
    4. Go to "List installed" tab and validate that certificate got installer.
  2. Check the site via https://<domain> and https://www.<domain> from a different browser
  3. If automatic redirect from non-www to www and from http:// to http:// is desired use Redirecting site using apache configuration based options in /home/<user>/public_html/.htaccess
    For example
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www.rekallsoftware.com$ [NC]
    RewriteRule ^(.*)$ http://www.rekallsoftware.com/$1 [L,R=301]
    RewriteCond %{HTTPS} !on
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  4. Then set permissions using:
    chown <user>:<user> .htaccess


Migrate email

  1. Let us sync email from existing email server to new server using CentOS 7.x imapsync syntax
    1. SSH to CWP server as root and use
      yum -y install imapsync
    2. Sync a test user email using imapsync command
    3. Sync all other users using imapsync -- Might requires all user passwords
  2. After all data is migrated change MX records of email server to point to new server
    Do not use AAAA as CWP does not support IPv6
  3. Also make sure mail, webmail, ftp and cpanel subdomains point to new server via A or CNAME record
    No need to add these subdomains. These are available by default.
  4. Go to CWP of root. Go to "Web server settings" -> "SSL certificates".
  5. Click on Admin services and enable all four
  6. Send test incoming and outgoing emails
  7. Validate ability to check email via email client such as thunderbird or outlook

Email security settings

  1. Go to Email Accounts -> DKIM Manager. Click "Edit Records". See the value for default._domainkey and create the same TXT record in public DNS. Later validate that DKIM test is passing on the same page (Email Accounts -> DKIM Manager)
  2. Go to Email -> Email Aliases/Forwarder. Create a catch-all account by creating alias for * pointing to one of the users.
    Test this by sending email to no-such-user@domain.com id
  3. Go to Email -> Mailserver manager
    1. Select "AntiSpam/AntiVirus (recommended): " and "Install DKIM & SPF (recommended): "
    2. "Rebuild Mail Server"
    3. "Restart All Mail server services"
  4. Send test incoming and outgoing emails and validate
  5. Go to Email -> Antispam. Click on "Install Spamhaus"
  6. Again test emails by sending and receiving. Have a look at "Show original" to see which modules (DKIM, SPF, etc.) are working properly for outgoing and incoming validation
  7. shutdown old email server and delete it after a few days



Home > CentOS > CentOS 8.x > CentOS 8.x email servers > CentOS 8.x Control Web panel > Migrate web and email domain from existing server