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.

  1. The resource you’ll need to add is CDN.
  2. 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.
  3. Click Create

Create CDN Endpoint

  1. From the resource group, click on the CDN that you created in the previous section. For me, this would be wordpress.
  2. From the CDN profile blade, click + Endpoint.
  3. 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.

  4. Click Add.
  5. 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

  1. From within your WordPress administration portal (login if you’ve not yet done so), click on Plugins in the left menu.
  2. At the top, next the the Plugins title, click Add New.
  3. In the left portion of the screen, there’s a search box.  Search for WP Super Cache.
  4. You should see the plugin returned as the first option, click Install Now.
  5. Once installed, the same button you just clicked, will turn blue and read Activate.  Click it.
  6. You will be returned to the plugins page.  Under WP Super Cache, click Settings.
  7. Under the Easy tab, turn Caching On.
  8. Click Update Status.
  9. Under the CDN tab, Enable CDN Support.
  10. 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.)
  11. The Off-site URL is the URL of your CDN endpoint that you configured earlier.
  12. 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.