How to Move Your Wordpress Site From One Server ( or localhost) to Another Server?
Simple steps to deploy existing WordPress site
Do you want to migrate your WordPress site to a server from localhost?
Do you want to move your site from one server to another?
If one of your answers is Yes then you are at the right place.
This article will surely help you.
You need to follow some simple steps in the correct order :
Create a backup of your WordPress site
Move backup to your new server
Setup site on the server
Redirect site to your domain
1. Create a backup of the site
First, we need you to backup your site to move this on a new server. For this, we are using a Wordpress plugin, called Duplicator.
Duplicator has a great rating on WordPress repository and it's free as well. Feel free while using this plugin because it will take the backup of all your database, themes and plugins as well.
So for backup, you have to follow the following steps :
1. Download and install Duplicator plugin on your local site
You can download the duplicator plugin from your WordPress site dashboard.
From dashboard navigate to Plugins ➡ Add New ➡ Search Duplicator ➡ click on Install Now ➡ click on Activate.
2. Create a new package
Now you can see Duplicator in your dashboard. To create a new package, navigate to Duplicator ➡ Packages ➡ Create New .
Here we have three steps :
1-Setup : Click on the Next button to start the process.
2-Scan : Click on the Build button.
3-Build : Now download both the Installer and Archive files.
You can follow these steps also to backup your site. Now, we need to move our backup (these two files) to the server.
2. Move your backup to the server
Let’s move your site to the server so that various approaches can be used. You can use your FTP client also, but here we are using an rsync command to send files from local to the server. For error-free installation follow given steps :
Move your Installer and Archive files in a new folder. We have named it my_site .
Now run the below command to move my_site folder on server:
Here 0.0.0.0 must be replaced with your server IP address. Also /var/www/html directory is available on your server.
After running the command you can log into your server and check that files are available there.
3. Setup site on the new server
All your local work has been finished. Now, let's set up your site at the server by simple steps:
You need a database on the server. So, now create a new database for your WordPress site using MySQL or PHPMyAdmin on your server.
Fire up your browser and navigate to http://YourServerIP/installer.php
NOTE: If you got a permission error change the owner of your project directory on the server by running the following command :
$ chown www-data:www:data /var/www/html/my_site
Here we have four steps for setup our site : Step - 1 : Here you can see the interface of installation. You need to accept the terms and click on Next button.
Step - 2 : In this step, you need to configure your database by putting the database name with user_name and password of your database. Now test the database and click Next button.
Step-3 : Here no need to change just click the Next button.
Step-4 : Click on the Admin Login button and you see your WordPress website is live now.
Your Website is live now
Your WordPress site is live on http://your_server_IP/my_site . You just need to put your Username and Password to login to your wp_admin dashboard.
4. Redirect site to your domain
Now you need to configure your site to your hostname. So whenever your visitors type your website hostname they redirect to your website.
First, you need to change your Wordpress URL and Site URL from your WordPress dashboard and save this.
Now we need a virtual host on our server. For this we are going to use apache server. You just need to create a conf in /etc/apache2/site-available/ for your website. A sample conf file for my site my_site.conf is given bellow :
Make Sure you enable the conf site. For this you need to use following command :
$ a2ensite my_site
Now restart apache server :
$ service apache2 restart
Now fire up your browser and navigate to https://your_host_name.com . Here you can see your site is working properly.
Congratulations !! your wordpress website is successfully deployed on the server and now you know how to move wordpress site on the server.