The Ghost blogging platform is a 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 running 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.
Deploying Ghost 2.0 in an Azure 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
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.
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!
Join the Jar Tippers on Patreon
It takes a lot of time to write detailed blog posts like this one. In a single-income family, this blog is one way I depend on to keep the lights on. I'd be eternally grateful if you could become a Patreon patron today!Become a Patron!