WenderHost

(865) 270-6715
or email us

Mirror a Dynamic Website on a CPanel/WHM Server

Step 1: Selecting your service providers
As this technique requires several "moving parts", your selection of service providers is vital as they will need to offer the services that you need along with the support necessary to make configuration changes that you can not make in a typical shared hosting environment. Keeping this in mind, I am going to list the providers* that have allowed me to successfully setup a CPanel mirror:

  1. Your Production Server
    Your production web server will need to allow SSH access. (In my case, I use Network Redux as my preferred web host. They have excellent technical support, a blog reporting on their network status, and their president called me personally when I had some specific pre-sales questions.)
  2. Your Mirror Server
    Your mirror server will need to be located in a different geographical location than your production server. In addition, your web host must allow the following:

    • ssh
    • rsync

    And, when you/they setup your account make sure of these details:

    • Your mirror account username must match the username of your production server.
      (This is important when you are syncing MySQL databases as it makes it much easier if your databases share the same name, and as you CPanel users know, CPanel database names are typically appended with the username associated with the server e.g. jsmith_).
    • Setup your mirror account with its name being a subdomain of your production server's domain (e.g. production = yahoo.com; mirror = mirror.yahoo.com; I had to ask my host to do this for me).
    • Park your production domain on top of your mirror account. This way when your fail over switching gets activated your mirror server will serve up its website. (The CPanel may throw an error when you try to park yourdomain.com on top of mirror.yourdomain.com. In that case, submit a support ticket to your web host.)

    Finally, once your mirror account is active, edit the DNS for your production domain and add an A record with your mirror's subdomain pointing it to the IP address of your mirror.

    Given the need for ssh, rsync, and tinkering with the domain and username associated with my mirror account, I selected Swift Communications' Bronze shared hosting package to serve as my mirror.

  3. DNS Failover
    You will need a DNS service that provides some sort of "DNS Fail Over Switching". This is exactly the type of service that DNS Made Easy provides. Their service lets you create multiple A records for a domain. Then their DNS Failover system will monitor the server located at your first A record. If that server goes down, the Fail Over switching will automatically switch your domain to point to the second IP address on the list. I have tested their switching with my mirror, and I have found that their DNS records typically propagate within 25 minutes.

Once you have these three pieces, you are now ready to proceed to Step 2: Setting up public key ssh authentication.

*NOTE: Please be advised that, where possible, I am providing affiliate links to the service providers listed in this article. Therefore, if you click on one of my links and purchase services, I stand to profit from your purchase. Plus, I list these providers because they have given me great service, and they have earned my endorsement. Furthermore, if this tutorial is of benefit to you, you can easily repay my investment in your knowledge by simply taking advantage of the services that I highlight.

4 Responses to “Mirror a Dynamic Website on a CPanel/WHM Server”

  1. Naseer Khan says:

    Hi,
    Please could you tell me if you have ever done mirroring for the plesk web servers.
    Thanking you.
    Regards,
    Naseer.

  2. Davi Souza says:

    This is for ressellers, how to backup entire dedicated server with cpanel and whm???

    the sql sync isn“t good enough, imagine if i need to create all database of accounts??? is it possible to copy all information between the servers???

    thanks - but at all is very good tutorial....

  3. AndyW says:

    Michael, I find your article very informative and helpfull. Thank you very much for same.

    Was wondering since you posted it on 2007, how has the setup performed since then? Are you still using it or have you moved to a more advanced setup.

    Just want to get your production experience of it, before I implement it on a bunch of websites.

    Thanks in advance.

  4. Peter says:

    If the server still asks for password then you need to check the following permission in your server.

    * Change the permissions of .ssh to 700
    * Change the permissions of .ssh/authorized_keys2 to 640

    It took me 2 days to figure this out.

Leave a Reply

Copyright © 2007. All Rights Reserved.
WP Full Site Theme modified by Michael Wender. • Log in.