Skip to content

Move wordpress site to web apps on linux

I just moved this blog, a WordPress site from Azure Web Apps and MySQL on VM to Web Apps on Linux and Azure Database for MySQL. and it was quite easy. So I thought I’d share with you my experience on how to move WordPress site to Web Apps on Linux.

The site was hosted on Azure App Service which runs on Windows Server 2012 and the Database was a MySQL on Azure Linux VM. So it was a mix of PaaS and IaaS. It was working great but I always wanted to get more of the PaaS benefits for this site and be VM free 🙂 The resources looked like the below:

So when Azure announced Azure Database for MySQL, a Managed MySQL database service for app developers, that was the time for me to move from the MySQL VM.

Azure Database for MySQL delivers the following capabilities and allows me to adjust performance and scale within seconds:

  • Built-in high availability with no additional cost.
  • Predictable performance, using inclusive pay-as-you-go pricing.
  • Scale on the fly within seconds.
  • Secured to protect sensitive data at-rest and in-motion.
  • Automatic backups and point-in-time-restore for up to 35 days.
  • Enterprise-grade security and compliance.

So first, I started with the Database, created a new Azure Database for MySQL on the Portal as the following screenshot shows (source: Azure documentation)

2-1 Navigate to MySQL

Following that, I needed to migrate the Database from the MySQL Server on the Linux VM to the newly created DB. There are 2 ways to achieve this:

  1. Dump & restore
  2. Import & export

I opted for the Import & export option using MySQL Workbench and completed that exercise in few minutes.

Then, I changed the connection string to point to the new database and went on to move the web app. By the way, when moving to the Database I noticed a major improvement in Query performance as you can see in the below screenshots. (PS: I was running the MySQL server on a small VM: Standard A1 (1 vcpu, 1.75 GB memory))

Query Performance on MySQL running on VM
Query Performance on MySQL running on VM

 

Query Performance on Azure Database for MySQL

Next, I needed to move the WordPress site to Web apps on Linux which was as well very easy, I used the “Clone app” feature in App Service. I needed to upgrade the App Plan first as App cloning is currently only supported for premium tier app service plans. That was easy too, I used the Scale up feature to upgrade the app from Standard to Premium plan. Once on premium, I cloned the app to the newly created App Service on Linux and following that I scaled the site back again to Standard.

What I had left was to map the custom domain to the new IP and CName record.

Lastly, I wanted to use Application Insights and luckily you can now create Application Insights using an existing instance which is what I did so all my telemetry history was kept.

When done, the resources needed to run this blog were only 3: App Service Plan Web App on Linux, and Azure Database for MySQL as you can see in the screenshot below. The storage account is used for Backup and Application Insights for telemetry.

Now, if you do not need to move WordPress site to web apps on Linux and want to use the Azure Database for MySQL service for a WordPress site, you can choose it directly on the portal during the create process as the following screenshot shows:

Hope that was helpful. If anyone has any questions, feel free to shoot them in the comments.

Cheers!

Published inMicrosoft Azure

Be First to Comment

Leave a Reply

Skip to toolbar