Let’s move it
A website is one of the most important marketing mediums for a business. In a lot of cases it’s your businesses shop front. Therefore it is important that in runs on a reliable and robust platform. Today you can create and run your own website using a few clicks of your mouse and keyboard using one of the many portals which are available to host your site. At Meritum Cloud, we decided to host our company website in Azure using App Services.
Prior to moving to Azure, we were using a popular provider of hosting services. In this blog post I will describe the process of migrating our website from the hosting provider to Azure App Services.
So what is it Azure App Service? It is a service which allows you to create a powerful cloud app using Platform as a Service. You can create websites using many different tools and languages in Azure. The list of all web application which Azure supports is available here.
Migrating WordPress site to Azure App Services
The most important thing is to have a backup. We are using WordPress, so I decided to a backup website through a plugin – All-in-One WP Migration. Of course there are many ways to backup websites, but I used this extension because it is easy and fast to use. Using the All-In-One WP Migration tool you need to remember about space quotas. If your website has more than 500MB, you need to buy the full plugin version. If you don’t you will get an error during restore asking you to upgrade to the paid version.
WordPress in Azure
< Azure Marketplace
There are many ways to run WordPress in Azure. You can provision the solution manually or use the Azure Marketplace.
Using the Marketplace, we need to decide which version of WordPress we want to choose because Azure offers us version for Windows and Linux. When you type WordPress in Azure Marketplace it will return a list.
This is because third-party companies offer their software and solutions in Azure and your choice could be an IaaS or a PaaS solution. You can filter by Category – Web means PaaS and Compute is IaaS.
I choose WordPress as a Web solution because I want to use PaaS. Once you have chosen, click Create.
App Plan configuration
Now you need to give a name for your web application – it needs to be a unique name, choose a subscription, and choose the Resource Group where your application will be stored.
Next, you need to decide which Database provider to choose. I chose Azure Database for MySQL with the S1 plan.
After choice the App Plan we need to configure our database server. During the database server configuration, we need to choose the pricing tire which will be the best for our web application.
After all the steps, we click Create and wait for the deployment of our application will finish.
Speed Up your website
WordPress admin portal
When the deployment is finished, we can check our website using the address application_name.azurewebsites.net. In my case it is meritumblog.azurewebsites.net, and I can see the WordPress process installation. After finishing the configuration of the WordPress installation I can log in to the admin portal.
Let’s get back to the portal and speed up our WordPress website.
We need to go the Application Settings and change setting Always On to the On, because by default it is turned off.
Add your domain
It’s a good time to add our domain in the Azure portal. We can do it after, but I prefer to restore a backup to a well-prepared environment. We need to go to our Web Application and move on to the Custom Domains. Click Add hostname and follow the instructions.
In this step, we have the option to change DNS records in our domain name provider but it is not mandatory. One thing you need to make sure is you add records according to the instruction from the Azure portal.
Add SSL certificate
Under the Custom domains, you can see the tab with SSL Settings. First of all, add your certificate to Azure by clicking the Upload Certificate. Upload the certificate, put the password and then click Upload.
Your certificate will be shown under Private Certificates.
Let’s bind the cert to our WordPress site by clicking Add binding and on the left panel select hostname to which you want to bind the certificate. Select your hostname, valid certificate and SSL Type and then click Add Binding
In my case, as I mentioned, I used a plugin to backup, and I will use the same plugin to restore the website.
WordPress General Settings
In the WordPress admin portal go to the General Settings and ensure that both URLs direct to your correct hostname. After using the plugin to restore the website it is good to check all links and replace if required with Search and Replace plugin. There is also a manual way to Search and Replace links which have *azurewebsite.net string using MySQL query directly on the database.
If you did not change DNS records in your domain host provider, now is the moment, when you should do it.
Remember, that DNS records changes can take to few hours, but usually it takes a couple of minutes.
If you did everything ok, you can enjoy your website which is now running in Azure.