In this part, we'll install the underlying components necessary for a Ghost blog, we'll purchase a domain name, we'll purchase and attach a domain name to your instance, and we'll successfully create your blog.
1. Now that you are connected to your instance, it’s time to install NGINX which will route traffic from your IP address to this newly created folder. Within your SSH Shell, type each of the following commands separately and press enter. You will be prompted to proceed, and type ‘Y’.
sudo apt-get update sudo apt-get upgrade sudo apt-get install nginx sudo ufw allow 'Nginx full'
(sudo commands force you into the ‘root’ user, where all changes will be immediate. Proceed with caution.)
2. Voilà! You might not realize it, but your website is live! Simply enter your instance’s public address—found in the connection string you used on step 19, or in the instance view—into a browser window:
3. (Optional) If you would like to, you can edit the file located at
/var/www/html/index.nginx-debian.html, and those changes will be live on the Internet. This will require either learning a text editor like vim (and basic shell navigation commands like
cd) or downloading a more robust SSH client like Coda.
Purchasing a domain name
4. At this point, you will want to purchase a domain name at a domain name registrar like Google Domains. This allows you to share a website address instead of an IP address—e.g. instead of 18.104.22.168, I can share deankroker.com, kroker.me, or myblog.fun. The nice thing about Google Domains is email forwarding to your personal inbox and domain privacy protection are included in the cost of the domain.
Microsoft only allows businesses to purchase domain names, but Google Domains, GoDaddy, and Uniregistry are good alternatives to consider. Google Domains consistently charges between $9 and $12 per year for a domain name, with certain top level domains—e.g. .blog, .app—costing more. Uniregistry has deals from time to time with domains costing as low as $2 / year.
Find a domain name that is available and make the purchase.
5. Navigate to your domain’s DNS settings in order to connect it to the new web server. E.g.:
6. Under ‘Custom resource records’, add an A record with the default settings. Enter your instance’s public IP address, and press ‘Add’
7. Wait for DNS propagation—i.e. for domain name system name servers to update with the IP address/domain name mapping you entered. You can check here to see it happen in real-time.
Setting up your blog
8. At this point, I’ll be mostly following Ghost’s setup guide, found here. We will be setting up a basic blog at the domain name you directed toward the instance you created.
9. Back to your terminal, we will be installing MySQL, Node.js, and Ghost CLI. MySQL is the database that hosts your blog content, Node.js manages routing and dependencies for your blog, and Ghost CLI is the underlying platform needed for your blog to run. Re-run the SSH command you retrieved in Step 19 if your SSH session has expired.
(Replace ‘password’ below with a secure password for your database server, and keep it in a safe place)
sudo apt-get install mysql-server sudo mysql ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; quit
10. MySQL is installed, next up is Node.js:
(These instructions install Ghost’s recommended version of Node.js)
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash sudo apt-get install -y nodejs
11. Node.js is installed, next up is the command line tools for Ghost:
sudo npm install ghost-cli@latest -g
The final steps
You have created an instance on an Azure virtual machine, have configured a network interface to allow connections to your instance, have purchased and configured a domain name, and have connected to and installed all of the necessary prerequisites. Now it’s time to get your blog up and running!
12. If your SSH session has expired, re-run the SSH command you retrieved in Part 1 of the tutorial. Next, you’ll decide where to setup your blog. I decided to place all my websites in a folder located at
/var/www/blog. Go ahead and run the following commands to set up your file directory.
(Recall that the SSH connection string you used contains your username—azureuser in our example. When executing the command below, you will be granting directory ownership to your username. If you chose something other than azureuser for the username, update the second command.)
sudo mkdir -p /var/www/blog sudo chown azureuser:azureuser /var/www/blog sudo chmod 755 /var/www/blog cd /var/www/blog
(chmod 755 will grant read/execute access for users and is typically used for public directories.)
13. Install Ghost
14. When prompted for your blog URL, enter the domain name you purchased earlier.
15. Next, you will be prompted with several questions.
(Retrieve your MySQL password and enter when prompted, and enter your personal email address when prompted. Other configurations can match what’s entered in blue below.)
16. Voilà! You should now see the default Ghost blog when you visit your domain name:
In Part 3 of 3, we'll cover more about Ghost and will configure a free SSL certificate for any static websites you own. Go to Part 3