Are you looking for a reliable and affordable option to host your static website? Well then, Azure Storage could be an option worth considering.
What is Azure Storage?
The Azure Storage platform is the cloud storage solution provided by Azure; it provides different storage services for diverse needs.
For the sake of this post, we will be focusing on Azure Blobs. Among different purposes, Azure Blobs is designed for serving images or files directly to a browser, distributed file access, video and audio, log files, backup and restore files and analysis data.
Azure Blobs can be accessed via HTTP/HTTPS via different Azure services or client libraries.
What is a Static Website?
Please note that the type of Website that we will be hosting in Azure Storage is a Static Website.
A Static Website is, by definition, a web page that is delivered to the user’s web browser exactly as stored, in contrast to dynamic web pages which are generated by a web server.
However, it is important to understand that a static website do not necessarily means boring, plain HTML sites, it just means that hosted files will be served as they are stored with no processing done on the server side.
This means that we can have a static web application with code that runs on the client’s browser, which executes all king of complex functionalities and getting dynamic data from cloud functions or external APIs. This does not sound completely static, right?
Therefore, you can host any web application which runs on the client with whichever framework or technology you prefer, as long as it does not need server processing; in another words, an application that can work with read-only files on the server.
Host a Static Website with Azure Storage.
With Azure Storage, you can serve static content directly from a storage container named $web.
To enable website hosting on your Azure Storage account you just need to sign into your Azure account, locate your storage account and enable the Static website option.
Once you have enabled the Static website option, the only thing left to do is to upload your static website files. You can do this very easily using the Storage Explorer which is built into the Azure portal.
Apart from the Storage Explorer, you can upload your files using the different methods that Azure provides like AzCopy, PowerShell, CLI or any custom integration.
With the files in place and the Static website option enabled we can go and type the URL provided by Azure for our static website.
That’s all, our static website is alive. Now, you can go and look at my Hello World static website hosted by Azure Storage.