[backcolor=var(--global-palette7)]Note: This post is a few years old. People still find it useful. But tech has moved on, and if there are any errors, please let me know, and I’ll update it.
When I started this blog, I forgot to configure the www. prefix, which seemed important at the time. Damn it!
There were so many steps to meticulously follow to get the blog going when self-hosting on DigitalOcean, and I was a little afraid to do anything to modify the configuration.
When I wanted to go add the new domain, there were a few steps. It took scouring around the internet, but I eventually found how.
The same general rules apply to adding new domains (e.g. if you want to change the domain name of your blog).
[backcolor=var(--global-palette7)]You can add domains like this if you’re self-hosting using [color=var(--global-palette-highlight)]
DigitalOcean. But it’s not terribly easy to self-host, and involves editing your core site code.
A much easier way is to
host your blog on [color=var(--global-palette-highlight)]Ghost Pro, and let Ghost do the heavy lifting for you. It’s cheaper in many cases, and simpler to use.
Table of Contents
Step 1: Point the new domain at your IP addressFirst, you need to create your new domain or subdomain with your host (I usually use Hover). Then, point the domain at your IP address
Do this with your domain admin. In my case, it was in Hover, but it would work with NameCheap, Godaddy, or one of the dozens of others.
I added one line, an A reference:
A redirect for Ghost blog – adding the wwwThat’s not all though — you also have to configure the server to receive the requests.
Step 2: Modify your NGINX configurationI use NGINX as a web server (for Ghost). For most out-of-the-box servers, NGINX is the default (I’ve never heard of someone using Apache with Ghost).
Go to /var/etc/sites-available. You need to modify two files:
- your-site.com.conf (non-SSL version)
- your-site.com-ssl.conf (SSL version)
In both of these, you need to add in the new domain or the www. prefix into the configuration. Open up one of the files:
sudo vim /var/etc/sites-available/your-site.net-ssl.conf
In it you’ll find the server block (it’s the only thing in the file, it’s right up top), where you add the www prefix (added in the image below, right after ‘hooshmand.net’)

Then restart nginx:
sudo service nginx restart
To be honest — I’m not sure if it’s necessary to restart Ghost, but I did it and it was painless.
In your ghost folder: ghost restart.
Step 3: Create/add certificates for your new domainsAfter you’ve modified nginx, you need to add certificates for your new domain. You actually are going to add the www subdomain to the existing certificate.
To do this, you use certbot.
Note that certbot is called letsencrypt on some installations.
Certbot will ask you some questions. The answers are:
- When it asks you something like ‘There is an existing certificate. Do you want to add the new domain to the existing one?’ you say ‘yes’.
- When it asks you something like ‘Do you want to redirect non-https traffic to https traffic?’ also say you want to.
That’s it! It should be working now.
Wrap upIf you have any trouble with this, let me know. If you can update this post, also, tell me how — I respond to all emails.