How to move Wordpress site to new CentminMod

by Daniel Pham
Published: Updated:

How to move Wordpress site to new CentminMod hosting? You have just installed a new CentminMod server, you have a WordPress website running on the old server.

Now, how will we transfer your website to the new server?

Important note

1. You should read the article how to use Let’s Encrypt SSL in CentminMod that I wrote before. This article will reuse it.

2. If you do everything quickly. The downtime time of the website is only about 5 minutes. You can do it at the night so you don’t affect the reader.

3. You should backup the source and database of your website.

4. You need to transfer the backup file of your website to the new server before taking the next steps.

Point the DNS domain of the website to the new server

This is where your website has downtime. But this is required if you want to use Let’s Encrypt SSL on the new server.

Because, when creating a new website on the new CentminMod server, it will verify whether your DNS record is pointing to this server.

And if you haven’t pointed your domain to the new server, the installation of the SSL certificate will fail.

Move Wordpress site to new CentminMod hosting

Create a new WordPress website on the new server

Type centmin to open the program menu. At the menu, select number 22 – Add Wordpress Nginx vhost + Cache Plugin.

And then you proceed to answer the questions to complete the website creation.

Do you want to continue with Nginx vhost site creation ? [y/n] y

Enter vhost domain name you want to add (without www. prefix): systemmen.com

Create a self-signed SSL certificate Nginx vhost? [y/n]: n
Get Letsencrypt SSL certificate Nginx vhost? [y/n]: y

You have 4 options: 
1. issue staging test cert with HTTP + HTTPS (untrusted)
2. issue staging test cert with HTTPS default (untrusted)
3. issue live cert with HTTP + HTTPS (trusted)
4. issue live cert with HTTPS default (trusted)
Enter option number 1-4: 4

If using Cloudflare in front of site, disable CF option for
Always Use HTTPS in CF Dashboard Crypto Tab as Nginx will do
the non-https to https redirect on this end and not require
Cloudflare's Always Use HTTPS. If enabled it will cause the
error message: too many redirects

Theme Setup: 
Install CyberChimps Responsive Theme (cyberchimps.com/responsive-theme/) [y/n]: n

Wordpress Setup: 

Not a fan of Gutenberg Editor ? You can switch to Classic Editor
If you run into Gutenberg Editor issues, you can later switch to
the Classic Editor https://wordpress.org/plugins/classic-editor/
Install Classic Editor Wordpress Plugin ? [y/n]: y

Autoptimize WP Plugin is installed by default. Do you want to install
companion Autoptimize Gzip Plugin to precompresses js/css optimized files
details at https://community.centminmod.com/threads/15314/
Install Autoptimize Gzip Companion Wordpress Plugin ? [y/n]: y

Set custom WP Admin Display Name ? [y/n]: n
Install Wordpress in subdirectory /blog ? [y/n]: n
Disable Auto Generated WP Admin Username / Password ? [y/n]: n
Disable wp-login.php password protection ? (less security) [y/n]: n
Enter email address for Admin User for Wordpress Installation: [email protected]

Default is to install KeyCDN WP Cache Enabler Plugin
as it's more stable and reliable than WP Super Cache.
Redis cache may have issues with caching due to long 6hr cache TTL
You can select which caching method to use below:

--------------------------------------------------------
        Wordpress Caching               
--------------------------------------------------------
1) KeyCDN Cache Enabler
2) Redis Nginx Level Caching
3) Wordpress Super Cache
--------------------------------------------------------
Enter option [ 1 - 3 ] 3

you selected option 3 (Wordpress Super Cache) [wpscache=y]

Create FTP username for vhost domain (enter username): ftpaccount
Do you want to auto generate FTP password (recommended) [y/n]: y

FTP username you entered: ftpaccount
FTP password auto generated: W!7^nvthKR-nd?^G

You just need to pay attention to choose y when the script asks if you want to create ssl Let’s Encrypt certificate.

The parts that create the website admin account, install the plugin, it is not important. Because, the goal is to move your exists website to the new server. So just reply quickly to the script to work.

Press y to continue using acmetool in CentminMod.

-------------------------------------------------------------
ok: /usr/local/src/centminmod/addons/acmetool.sh
/usr/local/src/centminmod/addons/acmetool.sh issue systemmen.com wplived

-------------------------------------------------
acmetool.sh is in beta testing phase
please read & provide bug reports &
feedback for this tool via the forums
https://centminmod.com/acmetool
-------------------------------------------------

continue [y/n] ? y

Please wait a while for creating the website to end. You will receive the following message.

-------------------------------------------------------------

Success: Updated 'home' option.
Success: Updated 'siteurl' option.

-------------------------------------------------------------
FTP hostname : 192.168.1.10
FTP port : 21
FTP mode : FTP (explicit SSL)
FTP Passive (PASV) : ensure is checked/enabled
FTP username created for systemmen.com : ftpaccount
FTP password created for systemmen.com : W!7^nvthKR-nd?^G
-------------------------------------------------------------
vhost for systemmen.com created successfully


vhost ssl for systemmen.com created successfully

domain: https://systemmen.com
vhost ssl conf file for systemmen.com created: /usr/local/nginx/conf/conf.d/systemmen.com.ssl.conf
/usr/local/nginx/conf/ssl_include.conf created
Self-signed SSL Certificate: /usr/local/nginx/conf/ssl/systemmen.com/systemmen.com.crt
SSL Private Key: /usr/local/nginx/conf/ssl/systemmen.com/systemmen.com.key
SSL CSR File: /usr/local/nginx/conf/ssl/systemmen.com/systemmen.com.csr
Backup SSL Private Key: /usr/local/nginx/conf/ssl/systemmen.com/systemmen.com-backup.key
Backup SSL CSR File: /usr/local/nginx/conf/ssl/systemmen.com/systemmen.com-backup.csr

upload files to /home/nginx/domains/systemmen.com/public
vhost log files directory is /home/nginx/domains/systemmen.com/log

------------------------------------------------------------
SSH commands to uninstall created Wordpress install and Nginx vhost:
  /root/tools/wp_uninstall_systemmen.com.sh
------------------------------------------------------------

------------------------------------------------------------
Wordpress Auto Updater created at:
  /root/tools/wp_updater_systemmen.com.sh
cronjob set for every 8 hours update (3x times per day)
------------------------------------------------------------

Wordpress domain: systemmen.com
Wordpress DB Name: wp562884366db_46853
Wordpress DB User: wpdbf8fkxmr7wnw
Wordpress DB Pass: wpdb65cAmk1gglCc6P5QBwFn
Wordpress Admin User ID: 788520
Wordpress Admin User: xfp99uEEG2vDUgX1dV9RRAkCReV4GP
Wordpress Admin Pass: qmN6KGOjUvNRxAu9RNmP
Wordpress Admin Email: [email protected]

Wordpress wp-login.php password protection info:
wp-login.php protection file /home/nginx/domains/systemmen.com/htpasswd_wplogin
wp-login.php protection Username: wGrDpOWbHS3lSzynbxPQeOdsuRtgo6
wp-login.php protection Password: RZK04uKkbnMNNh5zNrx6YUTk5BUHgHSVvsL
https://wGrDpOWbHS3lSzynbxPQeOdsuRtgo6:[email protected]/wp-login.php

Resetting wp-login.php protection:
Step 1. remove protection file at /home/nginx/domains/systemmen.com/htpasswd_wplogin
     rm -rf /home/nginx/domains/systemmen.com/htpasswd_wplogin
Step 2. run command:
     /usr/local/nginx/conf/htpasswd.sh create /home/nginx/domains/systemmen.com/htpasswd_wplogin YOURUSERNAME YOURPASSWORD
Step 3. restart Nginx + PHP-FPM services
     nprestart

-------------------------------------------------------------
Current vhost listing at: /usr/local/nginx/conf/conf.d/

                       
Jul 30  11:33   1.1K   demodomain.com.conf
Jul 30  11:57   1.4K   virtual.conf
Jul 30  14:01   5.4K   systemmen.com.ssl.conf

-------------------------------------------------------------
Current vhost ssl files listing at: /usr/local/nginx/conf/ssl/systemmen.com

                       
Jul 30  13:11   424    dhparam.pem
Jul 30  14:00   1.7K   systemmen.com.key
Jul 30  14:00   1.2K   systemmen.com.csr
Jul 30  14:00   1.6K   systemmen.com.crt
Jul 30  14:01   333    systemmen.com.crt.key.conf
Jul 30  14:01   333    acme-vhost-config.txt
Jul 30  14:01   3.5K   systemmen.com-acme.cer
Jul 30  14:01   1.7K   systemmen.com-acme.key
Jul 30  14:01   3.5K   systemmen.com-fullchain-acme.key

------------------------------------------------------------
To complete setup:
  1. Enable Permalinks (DO NOT use links with .html extensions for performance reasons) i.e. /%post_id%/%postname%/
  2. Settings Menu > Super Cache > Easy tab and enable it by checking Caching On (Recommended) and hit Update Status
  3. Advanced tab & check Use mod_rewrite serve cache files & Don’t cache pages with GET parameters and Known User. 
    (Recommended), Cache rebuild for anonymous users, clear all cache when a post or page updated & hit Update Status
  4. Appearance > Theme Options (Responsive theme) > Home Page nav bar > Uncheck Overrides Wordpress front page option
------------------------------------------------------------

-------------------------------------------------------------
vhost for systemmen.com wordpress setup successfully
systemmen.com setup info log saved at: 
/root/centminlogs/centminmod_123.09beta01.b216_300719-135920_wordpress_addvhost.log
-------------------------------------------------------------
wpinfo.sh script saved at:
/usr/local/nginx/conf/wpincludes/systemmen.com/wpinfo.sh
-------------------------------------------------------------

You need to save the information above. You pay attention to the database information.

Wordpress DB Name: wp562884366db_46853
Wordpress DB User: wpdbf8fkxmr7wnw
Wordpress DB Pass: wpdb65cAmk1gglCc6P5QBwFn

Delete new website source and copy source website exists

Now, we will do the first thing, which is to delete the entire source of the newly created website.

You type the command below. Remember to replace systemmen.com domain into your domain.

rm -rf /home/nginx/domains/systemmen.com/public/*

Next, copy your exists website source here. For example, I place the source website in the /tmp/old-site directory.

mv /tmp/old-site/* /home/nginx/domains/systemmen.com/public/

Change the owner permission.

chown -R nginx:nginx /home/nginx/domains/systemmen.com/public

Edit database information in wp-config.php file

This is the second step, you open the wp-config.php file in the source website you just finished copying. Edit the database connection information to match the information I have noted above.

define('DB_NAME', 'wp562884366db_46853');

/** MySQL database username */
define('DB_USER', 'wpdbf8fkxmr7wnw');

/** MySQL database password */
define('DB_PASSWORD', 'wpdb65cAmk1gglCc6P5QBwFn');

Delete the table in the new database and import your database

move wordpress site to new centminmod hosting
Move Wordpress site to new CentminMod hosting.

Now type the following command to login to the newly created database.

mysql -u wpdbf8fkxmr7wnw -p'wpdb65cAmk1gglCc6P5QBwFn'

Next, type the command.

MariaDB [(none)]> use wp562884366db_46853;

Then type the command.

MariaDB [wp562884366db_46853]> show tables;

The result looks like the following.

+-------------------------------+
| Tables_in_wp562884366db_46853 |
+-------------------------------+
| 21250_commentmeta             |
| 21250_comments                |
| 21250_links                   |
| 21250_options                 |
| 21250_postmeta                |
| 21250_posts                   |
| 21250_term_relationships      |
| 21250_term_taxonomy           |
| 21250_termmeta                |
| 21250_terms                   |
| 21250_usermeta                |
| 21250_users                   |
+-------------------------------+
12 rows in set (0.000 sec)

Now type (or copy) the entire following command into the ssh window.

DROP TABLE 21250_commentmeta            ;
DROP TABLE 21250_comments               ;
DROP TABLE 21250_links                  ;
DROP TABLE 21250_options                ;
DROP TABLE 21250_postmeta               ;
DROP TABLE 21250_posts                  ;
DROP TABLE 21250_term_relationships     ;
DROP TABLE 21250_term_taxonomy          ;
DROP TABLE 21250_termmeta               ;
DROP TABLE 21250_terms                  ;
DROP TABLE 21250_usermeta               ;
DROP TABLE 21250_users                  ;

And finally, you import the database of your website. For example, the database file I put it in the /tmp/old-site directory.

MariaDB [wp562884366db_46853]> source /tmp/old-site/systemmen.com.sql;

And then, you’re done moving your website to the new CentminMod server.

Conclusion

I can summarize 3 steps to move your website to the new CentminMod server as follows:

  1. Create a Wordpress website, use Let’s Encrypt SSL.
  2. Remove the source of the new website, copy the source of the exists website into the home directory. Edit the information in the wp-config.php file.
  3. Delete new database tables, import exists database.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Orhan gut
Orhan gut
Guest
4 years ago

You rocks!
Thank you so much, it’s awesome!

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

2
0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.