10
votes

Is there any way to host static website (HTML + CSS + JS) in Azure? Like we do Amazon S3 Static Website hosting, they charge only for storage.

3

3 Answers

7
votes

UPDATE: 29-June-2018

It is now possible to host static websites in Azure Storage. You can read more about it here: https://docs.microsoft.com/en-gb/azure/storage/blobs/storage-blob-static-website


As of today, no. Azure doesn't have an equivalent of that. You can however host static sites as Web Apps and for free as well if you're comfortable with the restrictions with free tier.

6
votes

It's not officially supported, but if you hosted your site in Azure Blob Storage's root container and made the container publicly accessible, you could probably achieve the same affect. You can even give the blob storage account a custom domain name.

Only downside is that you'll have to figure out a good deployment story. Two of your options are to use an FTP-like client such as CloudBerry to manually deploy your site, or write your own deployment script using the blob storage api

1
votes

I found a way to host a static website in an Azure blob, using a subdomain and an http re-direct

I do the following

1) In Azure I create a storage account with a container ( called docs ) that has Blob access policy.

2) I upload my static website to the docs container using the storage explorer. This includes some PHP files in a sub folder.

3) In the DNS I set up a cname record for a subdomain ( called info say) with alias myblob.blob.core.windows.net ( where myblob is the name of my blob)

4) In the DNS I create an Http redirect for record to a file on the subdomain for www with url http://info.mydomainname.com/docs/index.html

5) In Azure I create a custom domain for info.mydomainname.com

My website then works however if someone knows the location of the PHP files then they can download them which means I must not store secrets in them.

I have asked if there is a work around here