Skip to content

Hosting your static site on Azure and make it superfast!

As of September the 20th, my site is hosted on Microsoft Azure, more specifically an Azure Storage account, using the Static Website feature! By making my site have a static front-end, the need to run it on script-enabled web-servers is gone and it can run on pretty much any host you can think of. Also by removing access to the dynamic scripts (WordPress back-end), the site’s attack surface decreased to 1/10 on an imaginary scale.

Previously my site was hosted on a donated cPanel web-host and for the small traffic my site gets, it was mostly fine. The donor however indicated they could no long provide the service and thus my hunt for a replacement host started. I wanted something new and a solution that would give me more peace-of-mind when it comes to maintaining the site. Having an unpatched WordPress install is a bad idea and the number of exploits of the worlds most popular blogging solution has skyrocketed lately.

So I could just get another PHP webhost or an Azure Web App to run my site, done deal but that still means I have to look after the software versions, plugin updates et cetera. I briefly considered using a managed WordPress host but they end up costing your a fair buck, especially if you want to host plugins or run big themes. A big trend in the open-source community is to export/generate a static-only version of their content and host it on GitHub Pages or ReadTheDocs.

Having a static site means no dynamic scripts or SQL statements to abuse or slow down your site but it will require some work to get it working when your site relies on said scripting. Often functionality like search, commenting and publishing require the dynamic PHP+SQL back-end and you’ll have to replace them with alternatives. The flow for the site is as follows:

In order to get full-text search going I resorted to the WP Serverless Search, a plugin that indexes your site into a XML file that get searched by the Javascript front-end. This works great for a tiny site but not so much for larger sites. To replace comments you could integrate social networks like Disqus or Facebook but I prefer my site free from spying analytics.

Alternatives to Azure Storage Accounts are Amazon S3 or GitHub Pages but for me Azure was a great fit. I’ll write a more complete how-to on how I migrated from a PHP-powered WordPress to an Azure-hosted static website.

Published inAzureWebsite / personal