Optimizing WordPress
Now that WordPress is successfully installed and operating, let’s increase its performance by caching content and using a Content Delivery Network (CDN).
Create CDN
Let’s go back to our resource group in the Azure Portal and add a CDN.
- The resource you’ll need to add is CDN.
- Please complete the form similarly to what you see below.
NOTE: Feel free to choose a different pricing tier if you’d like and are familiar with the differences.
- Click Create
Create CDN Endpoint
- From the resource group, click on the CDN that you created in the previous section. For me, this would be wordpress.
- From the CDN profile blade, click + Endpoint.
- Complete the form similarly to what you see below.
A couple of notes:- The Name must be globally unique among all Azure customers. This will be the hostname of your CDN.
- Important: The Origin hostname will be the default *.azurewebsites.net domain assigned to your App Service. It is recommended that, if you have a custom domain, you should configure the custom domain for your App Service first. Then, choose the custom domain here.
- Click Add.
- You should immediately see that the endpoint is being created. Once complete, you’ll see the status of your endpoint as Running.
Configure WordPress to use CDN
- From within your WordPress administration portal (login if you’ve not yet done so), click on Plugins in the left menu.
- At the top, next the the Plugins title, click Add New.
- In the left portion of the screen, there’s a search box. Search for WP Super Cache.
- You should see the plugin returned as the first option, click Install Now.
- Once installed, the same button you just clicked, will turn blue and read Activate. Click it.
- You will be returned to the plugins page. Under WP Super Cache, click Settings.
- Under the Easy tab, turn Caching On.
- Click Update Status.
- Under the CDN tab, Enable CDN Support.
- The Site URL should be the URL of your App Service (NOTE: This will be your FQDN if you’ve registered a domain with your App Service.)
- The Off-site URL is the URL of your CDN endpoint that you configured earlier.
- Click Save Changes.
Done
Congratulations! You’ve now successfully, created an optimized, scalable and fault-tolerant install of WordPress using nothing but Microsoft Azure PaaS components. As I stated at the beginning, this isn’t a hard thing to do; I’ve only tried to be as clear as possible. Once you do this a couple of times, setting up a completely new WordPress install will be fairly easy and quick. Additionally, you already have a MySQL database server and App Service plan created. Instead of adding everything, you can simply add another database to your MySQL server, add another Web App to the App Service plan, and configure a new endpoint on your CDN.
Next Steps
Once you’ve got WordPress up and running successfully, you can migrate your content (themes, users, plugins, database, etc.) over from a pre-existing WordPress instance. I recommend the All-in-One WP Migration plugin. It’s very easy and self-explanatory. If you do migrate over a pre-existing site, you may need to re-add and re-configure the WP Mail SMTP and WP Super Cache plugins.
Nice Explanation! Thanks for sharing this valuable article with picture visually which easy to understand.
wow !!!! that guide so EXCELLENT, thanks for dedicating part of your time to create a guide so detailed and easy to understand, I really had hours looking for how to perform the process of installing wordpress in azure on the internet and none of the guides I found convinced me, but this guide is above all, thank you.
One question, if I wanted to host several wordpress websites in the same web services, creating sub folders in the wwwroot portfolio, would there be any variation in the process ?, and the configuration of the custum domain as it would be configured? or do you recommend improve creating a web services for each wordpress installation?
Thank you,
Just to clarify… a web (“App”) service and a web site are two different things. The service is the host process (RAM, CPU, etc.) in which your site is running. When you created a web site, a service was also (automatically) created for your site to run in. The service is what you are billed on. Therefore, to answer your question, you can have a single App Service with multiple websites. Install a unique instance Word Press on each site and associate a domain with each of those sites. Then, all of your sites will run in the same App Service and you’ll only have to pay for one service. Hope this helps, let me know if you have any other questions.
[…] Install WordPress on Microsoft Azure PaaS […]
In the Azure marketplace there is now a Windows Server 2016 image with WordPress that comes pre installed with MySQL, IIS & phpMyAdmin as an alternative option: https://azuremarketplace.microsoft.com/en-us/marketplace/apps/cloud-infrastructure-services.wordpress-windows-2016?tab=Overview
The post configuration guide can be found on : https://cloudinfrastructureservices.co.uk/how-to-setup-wordpress-on-windows-2016-in-azure/
Andrew,
Great job on your marketplace image. It looks pretty good if someone is interested in a single VM, Windows-based solution. However, there are a few issues, in general, with your approach.
– Windows servers require adequate licensing. Most Linux distros do not.
– This architecture, by utilizing VMs, doesn’t scale well, especially with how WP saves images and media. First, in order to scale, you would need to create a VMSS with an image. Second, you’d need to configure WP to use blob storage or attach Azure Files to the VM and configure the correct path for WP’s media. This way, all WP instances in the VMSS would have access to the media files.
– There is some performance lag with ISAPI and processing PHP within IIS. Perhaps this not a big deal for Windows shops who require Windows machines, but still exists nonetheless.
– You’re now looking at an IaaS solution with multiple components that require human maintenance and manual patching. Besides licensing, you are looking at additional costs in human resources. Most of this overhead (and cost) is eliminated with a PaaS solution.
– DevOps is slightly more complicated because you’ll now need to create additional instances for Dev, Test, Stage, etc. With App Services, you can utilize deployment slots. Then, switch environments very easily with the click of a button.
Thanks for the feedback though!