Learn about Centmin Mod LEMP Stack today
Register Now

What is the best way to transfer a WordPress site to another server

Discussion in 'Install & Upgrades or Pre-Install Questions' started by EckyBrazzz, Jun 24, 2019.

  1. EckyBrazzz

    EckyBrazzz Active Member

    463
    95
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +177
    Local Time:
    4:57 PM
    1.17.x
    10.3.x
    I tried to transfer a WordPress site to a new server, but without any luck. I did this many times, but now with CMM it's a little difference.

    My installs are made with 22-1 and I changed that on the new server.
    Every time I create a new site using another option than 22-1 and transfer the backup of the site to the new server. After that I want to import the SQL, but that gives me got errors.

    Deleted the SQL, imported the old one, nothing seems to go right this time.

    I tried to manual rename tables, import them each by each. Well spent all afternoon/evening to get the job done. But at 08:00 GMT -1 it has to be online on the new server!!! So I'm running out of time.

    What is the best way to transfer it when using CMM. Already tried the easy way with duplicator, but that also was a no go.
     
  2. eva2000

    eva2000 Administrator Staff Member

    40,634
    9,023
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,891
    Local Time:
    5:57 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    right way is to backup and import databases you have done
    exact steps and commands you use to import ? exact error messages ? backups and imports of mysql sql files shouldn't have any errors when using mysqldump for proper backup
    again exact steps and commands and error messages ?

    backup database name dbname to sql file = /home/dbname-backup.sql
    Code (Text):
    mysqldump -Q -K --max_allowed_packet=256M --net_buffer_length=65536 --routines --events --triggers --hex-blob dbname > /home/dbname-backup.sql
    

    import sql file = /home/dbname-backup.sql to newdbname database where newdbname is database created by centmin.sh menu option 22 submenu option
    Code (Text):
    mysql drop newdbname
    mysqladmin create newdbname
    mysql newdbname < /home/dbname-backup.sql
    

    so you delete the newdbname that centmin.sh menu option 22 created on initial creation on destination server, recreate database via mysqladmin create and then import the database file /home/dbname-backup.sql into newdbname database
     
  3. asperty

    asperty New Member

    9
    9
    3
    Apr 13, 2019
    Ratings:
    +11
    Local Time:
    10:57 PM
    1.17.1
    10.3
    I'm not sure what is the best way, but for me the easiest is using All-in-One WP Migration

    I used it loads of times with centminmod, mainly for migrating test installs, but also for live sites.

    The free version is perfect good for small sites, but I use the unlimited extension and DO backups for off site backups to DO spaces. It requires some investment, but it is a one off, and has no restrictions on the number of sites.

    The benefit for me of the DO extension is migration is really quick. So the downtime for live sites is minimal once the vhost on the new server has been created and dns switched. I found cloudflare dns to also be helpful in a quick migration.

    You don't need to worry about the database, it does it all for you. You just need to edit the database on the new vhost to www prior to migration (if that is what you use), to save search and replace post migration.
     
    • Informative Informative x 1
    style="display:inline-block;min-width:400px;max-width:970px;width:95%;height:90px" data-ad-client="ca-pub-6669518204467592" data-ad-slot="4024536743" data-ad-format="auto">
  4. Razib Hasan

    Razib Hasan Member

    34
    13
    8
    May 31, 2014
    Dhaka, Bangladesh
    Ratings:
    +13
    Local Time:
    1:57 AM
    1.7.6
    5.10
    You may try duplicator plugin if your website data size isn't too high.
     
  5. EckyBrazzz

    EckyBrazzz Active Member

    463
    95
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +177
    Local Time:
    4:57 PM
    1.17.x
    10.3.x
    hmm, guess it's a little late now, but :
    1) I uploaded the old site, changed the DB settings in wp-config.php and DROPED the content and imported the old one ->> Setup page of WordPress appears
    2) Duplicator ->> Same story, wipes some other plugins and setting made by the installer of CMM
    3) Copy DB --> Both ways manual and with phpmyadmin
    4) Dropped old tables, changed all references in editor, saved each table, imported tables one by one --> Setup appears again.
    5) Several other ways not mentioned before, but don't remember details.

    Site name is the same, not added a www (sub domain for a country), other CMM sever with other caching.

    In all methods used I made sure that my wp-config.php had the correct db settings.

    I made transfers too so many sites in the past and never had any problem with it.
     
  6. EckyBrazzz

    EckyBrazzz Active Member

    463
    95
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +177
    Local Time:
    4:57 PM
    1.17.x
    10.3.x
    Yep, I use it also, take just a second to change the domain, it reflexes almost instantly to the new DNS.
     
  7. eva2000

    eva2000 Administrator Staff Member

    40,634
    9,023
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,891
    Local Time:
    5:57 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Can you compare/diff your old wp-config.php against the one created on new server before you overwrite it? Ensure prefix set correctly on dB?

    How did you upload the files via pure-ftpd or root user sftp? All files owned by nginx user/group and file/directory permissions correct?
     
  8. EckyBrazzz

    EckyBrazzz Active Member

    463
    95
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +177
    Local Time:
    4:57 PM
    1.17.x
    10.3.x
    Yes, prefix was set correctly
    Pure-Ftpd with SecureFX

    But are a little busy now to check it again, that Cloudflare issue gave me many work that needs to be resolved first. Sending e-mails to companies to explain what happened with Cloudflare. Got many rejections on requests that I made last Friday.
     
  9. EckyBrazzz

    EckyBrazzz Active Member

    463
    95
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +177
    Local Time:
    4:57 PM
    1.17.x
    10.3.x
    OK, finally got things working, except the SSL because had to many attempts with Let's Encrypt. Already copied them over from the old server, but guess I did it wrong. Now I get an SSL error on the site. That's not a problem because I hide behind a Cloudflare SSL, but want to get things have things good.

    Steps I took:
    I like a clean server not with old setting when using the other above suggestions that keep any garbage from an old install. Also don't like my desk to be a mess, nor my desktop. So it was a little more work.
    1. Downloaded all content from old server to my local machine
    2. Switched to new server on with Cloudflare DNS to prevent Let's Encrypt errors.
    3. Created new vhost on new server
    4. Printed settings of new Nginx helper plugin to use later in new vhost on new server.
    5. Switched back to old Server to prevent downtime with Cloudflare DNS
    6. Uploaded only the important things / plugins / theme and some other things because had a change in caching method ("Redis") so I did not want to have the old drop-in plugins etc.
    7. Created new BD of backup from old DB
    8. Dumped old DB
    9. Create correct user and permission
    10. Cleanup old DB and users created in previous attempts.
    11. Switched again with Cloudflare to have the site online!
    Job done in (slow) but clean manner. Only the SSL issue, I need to fix that ASAP. So any suggestions on how to fix the SSL are welcome :)

    And thanks for the above suggestions, but these really gave some problems. (have some stuff out of public folders for security reasons). So FTP was needed.
     
  10. eva2000

    eva2000 Administrator Staff Member

    40,634
    9,023
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,891
    Local Time:
    5:57 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Yeah 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):
    ./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.
     
  11. EckyBrazzz

    EckyBrazzz Active Member

    463
    95
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +177
    Local Time:
    4:57 PM
    1.17.x
    10.3.x
    Well I already did add the tool
    Code (Text):
    ./acmetool.sh acmeinstall
    

    and copied them but noticed on another site that I created but I'm missing some items.

    The copied site has these and I placed these inside the /usr/local/nginx/conf/ssl/yourdomain.com on the new server.
    Code (Text):
    ls -lah
    total 36K
    drwxr-xr-x  2 root root  270 Jun 24 23:54 .
    drwxr-xr-x. 5 root root  200 Jun 24 19:34 ..
    -rw-r--r--  1 root root  340 Jun 24 23:23 acme-vhost-config.txt
    -rw-r--r--  1 root root  424 Jun 23 19:58 dhparam.pem
    -rw-r--r--  1 root root 3.5K Jun 24 23:23 nl.domain.com-acme.cer
    -rw-r--r--  1 root root 1.7K Jun 24 23:23 nl.domain.com-acme.key
    -rw-r--r--  1 root root 1.3K Jun 24 23:23 nl.domain.com.crt
    -rw-r--r--  1 root root  340 Jun 24 23:23 nl.domain.com.crt.key.conf
    -rw-r--r--  1 root root 1.1K Jun 24 23:23 nl.domain.com.csr
    -rw-r--r--  1 root root 3.5K Jun 24 23:23 nl.domain.com-fullchain-acme.key
    -rw-r--r--  1 root root 1.7K Jun 24 23:23 nl.domain.com.key
    

    When the new server created a new vhost it has some more: BTW the /etc/centminmod/custom_config.inc is the same on both servers.
    Code (Text):
    ls -lah
    total 60K
    drwxr-xr-x  2 root root 4.0K Jun 23 19:59 .
    drwxr-xr-x. 5 root root  200 Jun 24 19:34 ..
    -rw-r--r--  1 root root  466 Jun 23 19:59 acme-vhost-config.txt
    -rw-r--r--  1 root root  424 Jun 23 19:58 dhparam.pem
    -rw-r--r--  1 root root 3.6K Jun 23 19:59 schweiz-domain.coupons-acme.cer
    -rw-r--r--  1 root root 3.3K Jun 23 19:59 schweiz-domain.coupons-acme-ecc.cer
    -rw-r--r--  1 root root  302 Jun 23 19:59 schweiz-domain.coupons-acme-ecc.key
    -rw-r--r--  1 root root 1.7K Jun 23 19:59 schweiz-domain.coupons-acme.key
    -rw-r--r--  1 root root 1.4K Jun 23 19:57 schweiz-domain.coupons.crt
    -rw-r--r--  1 root root 1000 Jun 23 19:59 schweiz-domain.coupons.crt.key.conf
    -rw-r--r--  1 root root 1.1K Jun 23 19:57 schweiz-domain.coupons.csr
    -rw-r--r--  1 root root 6.8K Jun 23 19:59 schweiz-domain.coupons-dualcert-rsa-ecc.cer
    -rw-r--r--  1 root root 3.3K Jun 23 19:59 schweiz-domain.coupons-fullchain-acme-ecc.key
    -rw-r--r--  1 root root 3.6K Jun 23 19:59 schweiz-domain.coupons-fullchain-acme.key
    -rw-r--r--  1 root root 1.7K Jun 23 19:57 schweiz-domain.coupons.key
    


    Strange :?
     
  12. EckyBrazzz

    EckyBrazzz Active Member

    463
    95
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +177
    Local Time:
    4:57 PM
    1.17.x
    10.3.x
    I guess that changing the caching methods does not work the way I wanted. My WordPress entered into the recovery mode when adding a category and a menu item. I'm glad that I had the site running on the other server, so I could quickly switch, but I have to investigate what is the causes it. I have some spare domains to test. Also, noticed a drop in performance with the 22-Private testing method. Before, my site loaded in 650ms afterwards in 1400+ms
     
  13. eva2000

    eva2000 Administrator Staff Member

    40,634
    9,023
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,891
    Local Time:
    5:57 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    no missing you had -ecc labeled ssl certificate and key related to dual RSA/ECDSA SSL certificate mode that you much of enabled on one server and not the other SSL - Nginx 1.11.0 introduces dual ECDSA + RSA SSL certificate support ! :)

    tried purging cache + disabling old cache wp plugin BEFORE backing up wordpress instance for transfer/import ?

    also try same caching method on old and new server to verify performance of new server matches old server first ?
     
  14. EckyBrazzz

    EckyBrazzz Active Member

    463
    95
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +177
    Local Time:
    4:57 PM
    1.17.x
    10.3.x
    Issue with duplicator:(:(:(:( My fault.....

    Dumping the files in private folder, yeah, that didn't work:):):)
    Now in public folder and Cloudflare, well I never did a transfer of a site that easy(y)

    Did so many transfers, not only WordPress.
     
    • Informative Informative x 1
  15. eva2000

    eva2000 Administrator Staff Member

    40,634
    9,023
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,891
    Local Time:
    5:57 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    practise is always beneficial :D
     
  16. EckyBrazzz

    EckyBrazzz Active Member

    463
    95
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +177
    Local Time:
    4:57 PM
    1.17.x
    10.3.x
    practise --> practice, using the keyboard also;)

    Made many typos in CMM and it hung over there without an option to quit it.
     
    • Funny Funny x 1
  17. eva2000

    eva2000 Administrator Staff Member

    40,634
    9,023
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,891
    Local Time:
    5:57 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    doh :oops::LOL::LOL: