Read all of the other posts in our series on Creating Azure (hosted) WordPress Websites without knowing php or MySql!
This is a 3 Part excerpt from our soon-to-be-released book, “Build Secure WordPress Websites in Azure – without knowing PHP or MySql“.
Part 1: Using Azure Blob Storage to Store and Deliver WordPress Media and Uploads
Part 3: Using ‘Windows Azure Storage for WordPress’ Plugin for Hosting Media and Uploads
1. With an Microsoft account and an Azure subscription, in the Azure Resource Manager (ARM) portal, set up a Storage Account:
We chose Account Type – General purpose and Locally-redundant storage as the most cost-effective options.
2. Create a Blob container. In the ARM portal, navigate to the just created sitesbackup Storage Account > select Blobs Services:
We need to add a container that will give public access to the Blob service, as opposed to the default private status of containers.
Add Container > name and select the Blob Access Type > OK. We chose ‘Blob’ Access Type to give the contents of this Blob container ‘public read access’ for the image and other media blobs/files that will be stored here and delivered by hyperlink to our WordPress site.
3. We will use Microsoft Azure Storage Explorer (MASE) to locally drag & drop files into the new Blob container.
- Download and install the latest version of MASE. Read more about MASE here.
- In MASE, sign in to your Azure Subscription and navigate to the new Storage Account and Blob Container:
- We can now easily upload, drag/drop or copy/paste files or folders of images for the WordPress app service (website) from a local client over to the Azure Blob container.
- I create and save a local folder for the images and any other files to be used in the website, then I drag and drop this folder into the virtual directory structure of the blob storage container via MASE, creating a customized directory structure.
- This is a major improvement over using WordPress Media Library’s limited organization by date alone.
- This makes it faster to reuse the resources in another page, post or website, or just to be able to find a specific file for deleting
- We also eliminate the auto-generation of multiple versions of the same image file that WordPress Library creates with each upload
4. The simple way to get the hyperlink for a file/blob, is to select the file, and then click Copy URL in the menu for the open tab:
For example, the hyperlink to the highlighted img3.png in the screenshot above is:
https://sitesbackup.blob.core.windows.net/wpmediablob/Kudu/img3.png
When I paste the above hyperlink into a WordPress post’s or page’s edit screen, the image appears – simply done!
- It is possible to use a Custom Domain for the hyperlink to the Blob container contents, instead of the longer Azure “blob.core.windows.net” domain. The above link could then be (using the same folder organization structure as the underlying blob storage):
http://sitesbackup.alvarnet.com/wpmediablob/Kudu/img3.png
- However, at the time of this writing, a Custom Domain is only available in ARM using HTTP – not HTTPS. Our choice is to only use HTTPS, so we choose to use the xxx.blob.core.windows.net domain of Azure blob storage to deliver our blog images and other media to our WordPress websites in https.
- It is possible now to use an Azure CDN to deliver images/files to a website using both Custom Domains and SSL – we’ll cover that in another article!
- Also, for multiple site editors and content writers of the website, Microsoft Azure Storage Explorer easily provides Secure Access Signatures (SAS) to the Blob Storage – without having to share out your secure Azure Storage Account credentials. We’ll show how to provide SAS for access in a future post.
5. Verify that the images are being delivered by Azure Storage to the website front-end:
- On a website page in Chrome > R-Click on an image > Inspect > check the image address:
Part 1: Using Azure Blob Storage to Store and Deliver WordPress Media and Uploads
Part 3: Using ‘Windows Azure Storage for WordPress’ Plugin for Hosting Media and Upload
Read all of the other posts in our series on Creating Azure (hosted) WordPress Websites without knowing php or MySql!
Trackbacks/Pingbacks