Get the most out of your Centmin Mod LEMP stack
Become a Member

Wordpress Best way to prep a WordPress site migration?

Discussion in 'Blogs & CMS usage' started by ct_roy, Nov 16, 2023.

  1. ct_roy

    ct_roy Premium Member Premium Member

    47
    6
    8
    Jun 21, 2020
    Ratings:
    +12
    Local Time:
    1:46 PM
    1.17.10
    10.3.22
    I've set up new WP instances more times than I care to remember with CMM, but I'm a little less certain about how best to prep a migration of an existing live WP instance over to a CMM server. My overall objective is to minimize downtime by having the vhost and filesystem moved over to the new CMM server in advance of the DNS switch and have SSL's configured in advance if possible to (and in theory I should be able to test everything with a /etc/hosts local override too).


    Current existing state:
    1.) Website is currently running on a Ubuntu machine at www.mysite.com with an LE cert installed.
    2.) DNS managed via Cloudflare. Cloudflare proxy is enabled. SSL encryption mode is set to full.

    Proposed plan
    1.) Create new vhost on the centminmod machine via menu option 22
    2.) I have LETSENCRYPT_DETECT='y' set
    3.) I'll create a self signed cert - I'd also normally create an LE cert too, but I'm guessing this step will fail as the DNS isn't pointed to the new machine yet.
    4.) Once the vhost is created, I'll move the web root over to /home/nginx/domains/mysite.com/public
    5.) My DB won't need to be migrated as it sits on it's own machine.

    I guess I'll need to create the SSL cert manually after I've repointed my DNS?
     
  2. eva2000

    eva2000 Administrator Staff Member

    50,902
    11,799
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,255
    Local Time:
    11:46 PM
    Nginx 1.25.x
    MariaDB 10.x
    For moving site data there's 2 general guides where the principles & steps of backing up and moving data is the same just slightly different. These will give you a general idea of how Centmin Mod structure is laid out and where data is meant to be transferred.
    1. Moving Centmin Mod site data to another Centmin Mod server
    2. Moving cPanel/WHM site data to Centmin Mod server
    Those guides move alot more than just the site(s) in question but config files etc. You can use your own best judgement as to the config files and whether you want to move them or just use the fresh server setup Centmin Mod config files as they get auto optimised for the server Centmin Mod initially installed on.

    If your old site isn't centmin mod or cpanel/whm based, then those guides won't be 100% applicable. But the general overview of what needs moving and where everything is structured in Centmin Mod LEMP environment is worth reading up on.

    Also official site configuration files page explains the Centmin Mod structure of where the important files are so you can decide on what to backup.

    As for Letsencrypt SSL certs, you can on new Centmin Mod server create Nginx vhost with self-signed SSL cert first then do acmetool.sh reissue only command.

    Try acmetool.sh add reissue-only option for existing nginx HTTPS SSL vhosts with domain.com.ssl.conf vhost config files that exist. This only does reissue of letsencrypt SSL cert without touching the nginx vhost. Ideal for use when you tried creating a Nginx HTTPS SSL default vhost site but letsencrypt SSL issuance failed the first time. When it fails, Centmin Mod usually falls back to self-signed SSL as a place holder for the domain.com.ssl.conf vhost config. When you run:
    Code (Text):
    cd /usr/local/src/centminmod/addons
    ./acmetool.sh reissue-only domain.com live
    

    It will only try reissuing the letsencrypt SSL certificate for the domain = domain.com for live production SSL certificate without touching any of the existing nginx vhost at domain.com.ssl.conf

    Or you can copy over your existing Letsencrypt SSL certs and place them in appropriate place. Below is for Centmin Mod to Centmin Mod migrated SSL certs to give you an idea.

    If you copy SSL certs from old server from /usr/local/nginx/conf/ssl/yourdomain.com directory along with nginx vhost files (/usr/local/nginx/conf/conf.d/yourdomain.com.conf and /usr/local/nginx/conf/conf.d/yourdomain.com.ssl.conf), they will work on new server. One thing is with letsencrypt they need auto renewal as they have 90 day expiry, so you need to setup addons/acmetool.sh via acmeinstall command on new server
    Code (Text):
    cd /usr/local/src/centminmod/addons
    ./acmetool.sh acmeinstall

    and then copy over the /root/.acme.sh/yourdomain.com directory from old server too which contains the details acme.sh client needs for auto renew cronjobs.

    If you do need to regenerate and reissue Letsencrypt SSL certificates, you can follow steps 1 to 4 outlined at Migrating Existing Nginx Vhost From HTTP to HTTP/2 based HTTPS With Letsencrypt SSL Certificates
     
  3. ct_roy

    ct_roy Premium Member Premium Member

    47
    6
    8
    Jun 21, 2020
    Ratings:
    +12
    Local Time:
    1:46 PM
    1.17.10
    10.3.22
    thanks a million for the super comprehensive reply as always @eva2000 :)
    I'm going to do a deep dive on this now - will let you know how it goes!