Easy guide to Migrate your website from one server to another:

Easy guide to Migrate your website from one server to another:

This post will be helpful for you to understand for server migration. Recently I shut-down my older server for migrating my wordpress server hosting to new one. Previously I used AWS server. Now I am going to migrate to Godaddy VPS server.

Backup your website code base and Database From older server:

  1. First step you have to take backup of your code base and Databases dump before you shutdown the server.
  2. Take backup of your web server configuration from your old server. Ex: Nginx , apache.
  3. Note down the PHP version & Mysql you have used. Yes, taking one backup of configuration files is good .
  4. If you have used any additional add-ons or library then note the version & take backup configuration files if available.


  1. Be ready with your server.
  2. Be ready with Active Domain name
  3. Server should be available with enough resources to handle the post request and response (HTTP Calls).
  4. Server should have enough permissions to do the software installation & setting up configuration.
  5. Necessary support is required from your hosting provider (new provider) during the server migration time.
  6. Plan what software , libraries, packages , databases you want to install.
  7. If you are using any paid (3rd party) plugin, verify whether it will support your latest server configuration or not.

Note: Here I am going to explain below installation steps with Godaddy Ubuntu 16.04 server. Hope same below steps will be helpful for any other VPS/cloud server as-well.

Login your server via SSH:

Using host name, username & password (or) key login to your server in SSH/terminal. Default root directory is /home/<server Username> . We can run installation commands any where from your server path. It is not mandatory to go to specific path to run the commands. Use sudo if it doesn’t have enough permissions to run the commands. Start executing below steps/commands on your server

Ubuntu server is having the latest packages:

  • sudo apt update
  • sudo apt upgrade

Install PHP 7.4 on Ubuntu:

  • sudo apt-get install software-properties-common
  • sudo add-apt-repository ppa:ondrej/php
  • sudo apt-get update
  • sudo apt-get install -y php7.4

Note : In some PHP version packages apache will be installed automatically. For me I want to use Nginx instead of Apache. So I done uninstalled Apache & installed nginx with below commands

  • sudo service apache2 stop
  • sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
  • sudo apt-get remove apache2*
  • whereis apache2 //This command will show where apache folder is available.

Install Nginx:

  • sudo apt update
  • sudo apt install nginx
  • sudo systemctl status nginx
  • sudo nginx -v

Install PHP 7.4 FPM for Nginx

  • sudo apt install php7.4-fpm
  • Path: /var/run/php/php7.4-fpm.sock
  • sudo service php7.4-fpm status

Install MySQL on Ubuntu:

  • sudo apt-get install mysql-server
  • sudo mysql_secure_installation
  • sudo mysql -v


Default Username is : root / Password : “” (empty)

Above is the default user name for your mysql, if you want to create new use then need to run below commands in mysql (sudo mysql -u root -p)

Creating MySQL Users:

Connect Mysql > sudo mysql -u root -p

CREATE USER ‘<newusername>’@’localhost’ IDENTIFIED BY ‘<newPassword>’;

GRANT ALL PRIVILEGES ON * . * TO ‘<newusername>’@’localhost’;


Now connect mysql with new Mysql User:

sudo mysql -u <newusername> -p

>Enter <newPassword>

>CREATE DATABASE <mynewDatabase>;

>use <mynewDatabase>;

Import Older Database to new Database :

  1. Following command will helpful you to move older SQL file database dump into new Database (which is <mynewDatabase> )
  2. You have to move your older Database backup dump to any where in your new server location via any file manager Ex: WinSCP

Command: (Here I am using localhost as my host)

mysql terminal> mysql -u <newusername> -p <mynewDatabase> < /var/www/html/<OlderserverDBBackup.sql>;


Move Code base from your local (backup) system to Server Using WinScp:

Raw folder & files if you want to move to your server will it take more time to complete. To avoid delay, first convert your raw folder and files into ZIP. Move that file via WinScp. This steps will be reduce your raw file uploading time. In case of your doesn’t have zip package then use below command to install zip,

>sudo apt-get install unzip

>unzip <Yourcodebase.zip>

Unzip yourcode base zip from root path. Ex: /var/www/html>

Configure Nginx VirtualHost (Nginx conf file)

>sudo nano /etc/nginx/conf.d/<yourservername>.conf

Paste below code,

server {

listen 80;

server_name <mywebsite.com> www.<mywebsite.com>;

# Logs (access et errors)

access_log /var/log/nginx/access.log;

error_log /var/log/nginx/error.log;

# Root folder

root /var/www/html;

# Default file

index index.php;

location / {

try_files $uri $uri/ /index.php?$args;


# Add a slash at the end of request */wp-admin

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

# Deny files starting with a . (dot)

location ~ /\. {

deny all;


# PHP handling with FPM

location ~ \.php$ {

try_files $uri =404;

fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;



Note: above configuration is for wordpress nginx conf file. Depend on the domain you can change nginx conf file. This is just basic nginx conf file. Still we need to tune this file. Those point we will discuss in another post. Now almost your server is ready to publish. Before that restart nginx , php once again. Cross verify any logs are writing into log file.

Mysql Commands:

>sudo service mysql restart

>sudo service mysql status

>sudo service mysql stop

>sudo service mysql start

PHP commands :

sudo service php7.4-fpm status

sudo service php7.4-fpm restart

sudo service php7.4-fpm start

sudo service php7.4-fpm stop

Domain pointing:

Domain pointing changes based on the domain providers (dashboard). In my case, I have used godaddy domain, so Iam redirected to the following path in myaccount section after login.

Login godaddy → Go to DNS Management section → Configure Your server IP as like below & Update Cname Type as like follow

  • Type : CNAME
  • Name : www
  • Value : @
  • TTL : 1 Hour

Once after the configuration is done, do DNS check for your website.

Ex: https://dnschecker.org/

Enter Website URL: www.mr-jute.com

Select : A


Finally Done!!!

Save Water for Your Daughter !!!