How to Migrate WordPress to Azure

November 28, 2017Leron AminComments Open

Interested in hosting WordPress on Azure?

In this tutorial you will learn how to install WordPress on Microsoft Azure using the Bitnami version of WordPress on Azure.

This tutorial covers all the components necessary to migrate a WordPress website to Azure, including how to install WordPress on an Azure Virtual Machine, how to configure your domain name on Azure DNS, and how to transfer an exact copy of your existing WordPress website to Azure.

Running WordPress in a virtual machine on Microsoft’s Azure Cloud Platform allows you to harness the full power of the cloud, and take your WordPress website to the next level.

Is Azure right for you?

If all you’re looking to do is host a simple WordPress website, then Azure is not the best option for you; managed hosting providers are cheaper and easier to use. There are even managed cloud hosting providers such as Bluehost Cloud (view tutorial).

The main reason why you should host WordPress on Azure is because you’re developing a website that you predict will grow in size and complexity over time, and you require a platform built with the infrastructure that your website will require as it grows.

To get started, follow along with the video above. If you get stuck, check below to see the steps listed individually with their commands.

There are 3 parts in this tutorial:

PART 1: Deploy WordPress Installation

The first step in this tutorial to migrate WordPress to Azure is to install WordPress on an Azure virtual machine (VM) using a WordPress stack configured by Bitnami.

By default, WordPress is built on a software “stack” consisting of WordPress, Linux, Apache, MySQL, and PHP – meaning that you need to install each of these components to your Azure virtual machine in order to run WordPress.

Sounds time consuming, right?

The good news is that companies such as Bitnami have already configured and bundled these “stacks” for you. All you need to do is install them to your EC2 virtual Machine.

So let’s get started.

1. Launch VM Instance

migrate wordpress to azure deploy wordpress
After you’ve created an Azure account, navigate to the New section in the sidebar column. In the search bar at the top of the page, enter wordpress, then choose WordPress Certified by Bitnami from the list of WordPress installation options.

2. Configure WordPress Installation

migrate wordpress to azure deploy wordpress
After you’ve selected WordPress Certified by Bitnami, scroll down to the bottom of the information page and click the Create button in order to begin configuring your WordPress installation settings.

2.1 Basic Settings

migrate wordpress to azure basic settings
In the Basic section of the Create virtual machine column, fill out the information as shown in the image, making sure to change your Resource group settings to represent the region where you anticipate most of your website traffic will be coming from.

2.2 Hardware Settings

migrate wordpress to azure choose hardware
In the Size section of the Create virtual machine column, choose the A0 Standard machine type.

2.3 Network Settings

migrate wordpress to azure network settings
In the Settings section of the Create virtual machine column, leave the default settings as they are. However, if you require high availability for your application, make sure to configure the Avilability set options.

2.4 Finalize Deployment

migrate wordpress to azure finalize deployment settings
In the Summary section of the Create virtual machine column, add the required contact information. Then, click the Create button to finalize your deployment.

3. Login to WordPress

migrate wordpress to azure login to wordpress
Now that you’ve launched your WordPress application, the next step is to login to your WordPress Dashboard. To do this, click the Dashboard link in the left-sidebar column, then click the on the box that shows your WordPress virtual machine.

3.1 Retrieve Login Credentials

migrate wordpress to azure retrieve login credentials
Next, scroll down the secondary sidebar column to the SUPPORT + TROUBLESHOOTING section, and click on the Boot diagnostics link.
migrate wordpress to azure retrieve login credentials
From inside the Boot diagnostics section, click inside of the diagnostics log and type CTRL + F to open the search bar and type in application password, then press enter Next, copy the application password from the diagnostics log.

3.2 Access WordPress Dashboard

migrate wordpress to azure copy public IP address
Next, scroll towards the top of the secondary sidebar to the Overview section. From here, copy the Public IP address for your WordPress application and press enter. This will take you to the WordPress login page.
migrate wordpress to azure visit wordpress site
From your web browser window, paste the Public IP address into the URL address bar.
migrate wordpress to azure login to wordpress
From the WordPress dashboard page, enter user in the username field, and paste the password that you copied from the diagnostics log into the password field.
migrate wordpress to azure
That’s it! You’ve successfully logged in to WordPress!

PART 2: Transfer Domain Name

Great job! You’ve just installed WordPress on an Azure virtual machine!

The next step in this tutorial to migrate WordPress to Azure is to transfer your domain name to Azure so that it links to your website.

Taking the time to properly configure a domain name for your website is an easy way to prevent search engine indexing issues from occurring.

By default, your public IP address will be used as the domain for your website. However, using a public IP address as your primary domain is bad for your website’s SEO.

In this next section you will learn how assign a custom domain name such as yourwebsite.com to your WordPress installation on Azure.

So let’s get started.

1. Copy Virtual Machine IP

migrate wordpress to azure copy virtual machine ip
Before diving into this tutorial, you will first need to copy the external IP address of the virtual machine that is running your application. From your Azure dashboard, click on the box showing the virtual machine that is running your website application.
migrate wordpress to azure copy public IP address
Next, in the overview section of the left sidebar column, copy the Public IP address of your virtual machine – this IP address will be used in the later steps.

2. Create a DNS Zone

migrate wordpress to azure create dns zone
Return to your Azure dashboard, then click the New link in the left-sidebar menu to search the Azure marketplace. Type DNS zone in the search bar, then select the DNS zone option that appears.
migrate wordpress to azure create dns zone
After selecting the DNS zone option, scroll to the bottom of the page and click the Create button.
migrate wordpress to azure create dns zone configure dns settings
In the Create DNS Zone settings, enter your root domain in the Name field, and select the Resource Group attached to your application. Make sure the Pin to dashboard box is checked, then click the Create button.

3. Add “A” Record

migrate wordpress to azure create dns zone add record set
At the top of the newly created DNS Zone page, click on the + Record set link.
migrate wordpress to azure add a record
Configure a new “A” record using the Public IP address that you copied in Step 1. Make sure to leave the Name field blank. Click the Ok button to save changes.

4. Add “CNAME” Record

migrate wordpress to azure add a record
Now that you’ve added an “A” record to you DNS Zone, you will have to add a “CNAME” record. To do this, click on the + Record set link at the top of the page.
migrate wordpress to azure add a cname record
Configure your “CNAME” record by adding www to the Name field, and adding your domain name (without www.) to the Alias field.

5. Review Record Set

migrate wordpress to azure review record set
Look over your record set, making sure both the “A” record and the “WWW” record are appearing in the table.

6. Edit Domain Name Servers

migrate wordpress to azure create dns zone add record set copy nameservers
At the top of your DNS Zone page, copy the four name servers.
migrate wordpress to azure change nameservers
Next, go to your domain name provider and change your name servers to match the Azure name servers on the DNS Zone page.

7. Test Settings

migrate wordpress to azure change nameservers test settings
To test if your domain is configured properly, enter your domain into your browser’s URL bar. If your domain is configured properly, your application’s homepage will load. If you would like your domain to load with the WWW. prefix, read on for instructions.

Optional Configurations

How to Include WWW. Prefix

By default, your domain will show without the www. prefix.

If you would rather your domain show up as www.example.com instead of just example.com, then read on for configuration instructions.

NOTE: The instructions below are intended for users running Bitnami’s WordPress stack on Azure. If you’re using a different Apache configuration, remember to substitute the bitnami.conf file with your server’s htaccess equivalent.

migrate wordpress to azure configure www
Navigate to your Azure dashboard by clicking the Dashboard link in the left-sidebar column, then click on the box to open your virtual machine settings.
migrate wordpress to azure
At the top of your virtual machine settings page, click on the Connect icon, then copy the SSH command. Finally, click the Cloud Shell icon at the top of the page to open the terminal.
migrate wordpress to azure configure www
Enter your credentials to login to the virtual machine, then paste (CTRL + SHIFT + V) the SSH command that you copied in the last step.
migrate wordpress to azure configure www
Next, copy and paste the command below to open your server’s configuration file.
sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf
migrate wordpress to azure configure www
Now that you’ve opened your server’s configuration file, copy and paste the three lines of code below in the exact same location as shown in the image. Save changes to the file (CTRL + O) then exit (CTRL + X) to the home screen.

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
migrate wordpress to azure configure www
Finally, in order for changes to take effect, you need to restart your Apache server by executing the command listed below.
sudo /opt/bitnami/ctlscript.sh restart apache

PART 3: Import WordPress Website

Great job! You’ve just assigned a custom domain name to your new WordPress installation!

Using a WordPress Migration plugin is a great time saver when transferring a WordPress website between hosting providers.

The next step in this tutorial to migrate WordPress to Azure is to transfer an exact copy of your existing WordPress website to your new WordPress installation on Azure.

In this tutorial, you will use the All-in-One WP Migration Plugin to quickly transfer a copy of our existing WordPress website to our new WordPress installation on Azure.

1. Download WP Migration Plugin

migrate wordpress to azure install all-in-one wordpress migration plugin
From your existing WordPress website, head over to Add Plugins and download the All-in-One WP Migration plugin.

2. Export Website File

migrate wordpress to azure export wordpress website to file
Activate the All-in-One WP Migration plugin, and access it by clicking the link in your WordPress sidebar column. From the All-in-One WP Migration dashboard, select Export To > File.

3. Import Website File

migrate wordpress to azure import file
From your new WordPress Website installation, download the All-in-One WP Migration plugin and go to Import From > File. Choose the export file that you downloaded in the previous step.

NOTE: By default, the All-in-One WP Migration plugin only allows a maximum file upload size of 512MB. If you need to increase the maximum file upload size to 10GB+, check out this tutorial.

4. Change Permalink Structure

migrate wordpress to azure permalink dashboard
After you’ve successfully imported your WordPress website to Google Cloud, you will need to reset your permalink structure. From your WordPress dashboard go to Settings > Permalinks, and select the permalink structure that you prefer (I recommend post name).

NOTE: After finishing with the WordPress migration, you can uninstall or deactivate the All-in-One WP Migration plugin.

Did it work?

That’s it! You’ve successfully migrated your WordPress website to Azure, including installing WordPress, configuring a custom domain name, and transferring an exact copy of your existing WordPress website to Azure.

If you have general questions or comments about this tutorial, please post them below.

If you benefited from this tutorial, and would like to support my work, please like my Facebook page and subscribe to my YouTube channel.

Thanks,

signature

Leave a Reply

Your email address will not be published. Required fields are marked *

Made with by

© 2020 One Page Zen Systems, LLC  
Legal  |  Privacy Policy  |  Affiliate Disclosure  |  Contact  

Join our Mailing List!

Exclusive early access to the latest tutorials

Monthly update with a list of upcoming tutorials

Special access to members-only events and webinars