Azure Cloud

Configuring Custom domain, SSL Certificates: PART 5

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:

  1. Getting Azure Subscription, Creating App Service Plan and WordPress Web Service using My SQL In App
  2. Connecting Word Press website with WordPress.com and Installing and configuring Jet Pack
  3. 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
  4. Creating Azure Storage Account and configuring WordPress to use Azure Storage to store media files and Optimizing with persistent connection.
  5. Configuring Custom domain, SSL Certificates.
  6. Configuring Azure CDN, configuring back up scheduling in azure and Auto Scaling
  7. How to use REDIS CACHE with WORDPRESS on Azure
  8. 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

Godaddy.com Domain Manager or DNS control panel
Godaddy.com Domain Manager or DNS control panel

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.

 Custom Domains
Custom Domains

Figure 2 Custom Domains

You need to put two records in the DNS Manager of your domain

  1. ARecord
  2. CName
  3. 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

Adding A Record
Adding A Record

Figure 3 Adding A Record

I have put an A record in the DNS manager with IP address.

Adding CNAME record
Adding CNAME record

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.

Adding CNAME record
Adding CNAME record

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.

Adding host name
Adding host name

Figure 6 Adding host name

For my Root site validation, which is scientistz.com, this will check for the A record.

Adding Root Site as hostname
Adding Root Site as hostname

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

https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain

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.

https://www.codeheight.com/Blog/Jan2017

https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-ssl#bind-your-ssl-certificate

Uploading SSL Certificate
Uploading SSL Certificate

Figure 8 Uploading SSL Certificate

After you uploaded certificate, you need to add bindings for our site.

Adding SSL bindings
Adding SSL bindings

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.

Enabling HTTPS redirection
Enabling HTTPS redirection

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