Are you looking to create your very own Scalable optimized WordPress Site/blog using Azure MySQL, Azure Storage and Azure CDN, then this post series is for you?
I have divided the series into below parts:
- Getting Azure Subscription, Creating App Service Plan and WordPress Web Service using My SQL In App
- Connecting Word Press website with WordPress.com and Installing and configuring Jet Pack
- Creating Azure Database for MySQL and exporting the Data from My SQL In App to Azure Database for MySQL Server, Handling Security and Optimizing with persistent connection
- Creating Azure Storage Account and configuring WordPress to use Azure Storage to store media files and Optimizing with persistent connection.
- Configuring Custom domain, SSL Certificates.
- Configuring Azure CDN, configuring back up scheduling in azure and Auto Scaling
- How to use REDIS CACHE with WORDPRESS on Azure
- How to install application insights in WordPress on Azure
If you are not following along please check the previous part 1 first.
At this point, your site is connected with WordPress.com now we are moving to part , which is related to configuring Custom Domain and enabling SSL on our newly created WordPress site.
First, you need to get a domain from domain provider, I usually use Godaddy.com as they have very good integration with Azure and even you can purchase the domain from Godaddy.com within Azure itself.
We assume that you have purchased and own the domain and you have access to the Domain Manager or DNS control panel, below is the domain manager of the Godaddy.com
Figure 1 Godaddy.com Domain Manager or DNS control panel
Now in order to configure the Custom Domain go to your app and then settings-> Custom domains, as you can see Azure provide you the option to purchase the Domain with in the Portal itself.
Figure 2 Custom Domains
You need to put two records in the DNS Manager of your domain
- TXT Record
A Record with the IP address of the Web App, as you can see in above picture and CName with website URL, in my case it is wordpressite1.azurewebsites.net
Figure 3 Adding A Record
I have put an A record in the DNS manager with IP address.
Figure 4 Adding CNAME record
In addition, I have put the CNAME against www subdomain, in case you do not know www is subdomain i.e. scientist.com is main domain and www.scientist.com have www as subdomain. WordPresssite1.azurewebsites.net is specified in my case your case could be different.
Figure 5 Adding TXT Record
I also put a txt record for the main site as you can see above.
Once you are done with this, go back to azure and click on “Add hostname”, below window will open up mention your domain name and click on validate, remember Godaddy.com have good integration with Azure, so it will take few seconds to complete the validation process. For you it may take more time as it take some time to propagate the DNS settings to the world.
Below is for www.scientistz.com this will check for CNAME record validation.
Figure 6 Adding host name
For my Root site validation, which is scientistz.com, this will check for the A record.
Figure 7 Adding Root Site as hostname
Once validation is completed. Browse your site and check if everything work fine. For more information about the configuration, check this link
Now we assume everything just worked fine for you, let us move to SSL part, this part is very simple, all we have to do is Purchase a SSL certificate, upload to the Azure and add bindings and enable the Https settings for the site that is set.
Although before purchasing the certificate, make sure what is your requirement, if you want the certificate only for your domain and you do not have any plan to create sub domain, then purchase normal certificate, if you are planning to create multiple subdomains then you may need to go with wild card certificate. Azure accepts PFX certificate, you may need to convert the certificate or other types for example .CER to .PFX
You can follow below link if you need any help in this.
Figure 8 Uploading SSL Certificate
After you uploaded certificate, you need to add bindings for our site.
Figure 9 Adding SSL bindings
After adding the SSL binding now we just need to enable the HTTPS settings. Go to Custom domains and click on “On” button in against HTTPS Only option. This option will redirect all request received on HTTP to HTTPS.
Figure 10 Enabling HTTPS redirection
Access your site that everything is working fine there
Congratulations, you have successfully configured custom domain as well as SSL certificate for your site, upcoming next Configuring CDN, configuring back up scheduling in azure and Auto Scaling