Now that WordPress is successfully installed and operating, let’s increase its performance by caching content and using a Content Delivery Network (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.
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.
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.