The Ghost blogging platform is an open-source, fast, and simpler way to get started blogging than something like WordPress. If you have a Microsoft Azure subscription and a little bit of time, you can get Ghost on Azure in no time!
If you need to get up to speed on Azure App Services before diving in, I highly recommend these Pluralsight courses. If you don’t have a Pluralsight subscription, you can get a free 10-day trial here.
Note that you will be charged for any Azure resources you deploy. Be forewarned if you set up your blog and a month later get a bill! Although it should be minimal, always ensure you know the costs ahead of time.
Table of Contents
Deploying Ghost on Azure (2.0) with an App Service
The first step is getting an Azure web app or app service created and getting Ghost installed on it. Fortunately for you and I, a Microsoft Azure MVP, Radoslav Gatev has developed a one-click deployment for us making this process a cinche in his GitHub repository.
- Click on the Deploy to Azure button in the Ghost GitHub repo.
2. If you’re already logged into Azure, you’ll be presented with all of the options to deploy Ghost 2.0 into Azure.
Once you run through the deployment, you will soon have an Azure App Service in your subscription.
Add index.js as default document to Ghost on Azure
This is required for Ghost to show up when navigating to the root of our app service.
Find your Azure App Service in the Azure portal and then click on Configuration, then click on Default documents and add index.js in here as shown below.
Enable Always On
Although optional, I encourage you to enable the Always On feature to prevent your app service from occasionally shutting down.
Enabling Always on will ensure your site is always as fast as it can be. To do so, go the Configuration section of your app service and click on General settings. In here, you’ll find the option to enable Always on as shown below.
Add a custom domain
At this point, you could be up and running with Ghost on Azure if you’re OK with a <sitename>.azurewebsites.net domain name. Most of the time, I’m assuming that you’ll want to use your own domain. In that case, you’ll need to configure a custom domain.
- Navigate to the Custom domains section of your app service and click on Add custom domain.
2. Provide your domain name in the box and click on Validate.
You’re almost done getting Ghost on Azure set up!
Add DNS records
You will now need to set up a few DNS records in your DNS provider to make this work. I chose to use the A record.
You will need to set up an A record pointing to the External IP address of your app service.
You will also need to create a TXT record for Azure to verify you own the domain. The TXT record needs to point to<appservicename>.azurewebsites.net.
Once you create the A record to direct traffic from your domain to your app service URL and have created the TXT record, click on Validate again. After a little while, it should validate and allow you to create the custom domain.
Turn on HTTPS only
Although optional, I recommend turning on HTTPS Only to ensure all traffic is encrypted. You can do so by toggling the HTTPS Only option to On as shown below.
Finally, you can remove the TXT DNS record created earlier. That TXT record was only required to ensure you owned your domain.
Hosting your own Ghost blog is a great alternative to paid options. However, if you have some Azure credit or have a low-traffic blog, hosting Ghost on Azure is a great project to both learn more about Ghost and how Azure App Services work!
Here’s another great resource where we go over how to set up an Azure static site to work with Cloudflare.
More from Adam The Automator & Friends