I came across a project that taught me how to migrate a wordpress website from one server to another, after doing research I managed to successfully migrate my website from the old server to the new one.
In this article I will be making an assumption that you are using digital ocean as your Infrastructure provider and you have already installed the following software’s on your new server.
Create a server in digital ocean
Install Apache
Install php and its modules
Install Mysql or MariaDB
Harden Apache, enable rewrite module and enable SSL module
INSTALLING SSL WILDCARD
The first step to acquire an SSL certificate for your new server is to install certbot software. Certbot is in very active development, so the Certbot packages provided by Ubuntu tend to be outdated. However, the Certbot developers maintain a Ubuntu software repository with up-to-date versions, so we’ll use that repository instead.
First we are going to add the repository of certbot
sudo add-apt-repository ppa:certbot/certbot
and press ENTER to accept.
Install Certbot’s Apache package with apt:
sudo apt install python-certbot-apache
Certbot is now ready to use, but in order for it to configure SSL for Apache, we need to verify some of Apache’s configuration.
The next step is to Create an API token in DigitalOcean (https://cloud.digitalocean.com/account/api/tokens?)
Click on generate new token to get you token, once generated copy the token and paste it on your not pad.
Login the server, and create a file anywhere you like. for the tutorials we will create a file in /home/certbot/gititalocean.ini and put in this:
Note: in your new server there will be only the home folder, you will have to create the folder certbot
The next step would be to install the Digital Ocean DNS plugin for Certbot/Letsencrypt on your server. This can be achivied by typing the following command:
pip3 install certbot-dns-digitalocean
Note: If you don’t have pip3 installed, you can install it by typing sudo apt install python3-pip
Finally, generate your SSL. If you have an existing SSL you can delete it by typing the command
sudo certbot delete
then select the certificate/domain you wanna delete
After Installing the SSL certificate in the new server, the next step is to migrate the website from the old server to the new server. The first step would be to zip your website directory. Lets assume that your website directory is in /var/www/html. In this case you would zip html which contains all your website data. Transferring the website can be accomplished by typing the below codes. We are going to use acronym’s where S = server