Chai Phonbopit
Jan 21, 2016 · 4 min read

This post I am going to talk about how to install ghost blogging platform, set up DNS, Config Digital Ocean droplet and create articles on Digital Ocean.

Why I use Digital Ocean?

DigitalOcean Home Page

Because most of shared hosting provider doesn’t support Node.js. Then I looking for VPS instead and I found Digital Ocean, it offer just only $5 a month and one-click “application” installation. It’s mean you can create a ghost blogging just a minute. That’s easy!

If you need a Digital Ocean account, you can register with my referral here to get $10 free.


Step 1: Create Droplet

Firstly, Login to your Digital Ocean account, then click Create Droplet button, Choose One-Click Apps and select Ghost 0.8.0 on Ubuntu 14.04, select size and select datacenter depend on your.

Create Ghost with One-click apps

Then click Create and waiting for less than 1 minute, your droplet information (username and password) will be send to your email.

Login to your host, If your machine is Windows use PuTTy, if you used *nix you can run on Terminal. (Assuming 123.456.7.8 is your droplet ip)

$ ssh root@123.456.7.8

You’ll see welcome message like this

Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-71-generic x86_64)


* Documentation: https://help.ubuntu.com/

After logged in, System will force you to changing a password.

$ Changing password for root.
$ (current) UNIX password:
$ Enter new UNIX password:
$ Retype new UNIX password:

Now your ghost is available. When you put URL to 123.456.7.8 you will see your Ghost, Cool!


Setup 2 : Secure a droplet

Back to my droplet, every time when I access to droplet with ssh default port is 22 and user is root, I should change default port and user root for protected

Create a new user named chai (you can change a name whatever you like)

adduser chai

and then there is a prompt to fill additional information and strong password.

Add permission to allow chai user run super user command:

gpasswd -a demo sudo

Then, disable remote SSH access to the root account.

vi /etc/ssh/sshd_config

Next, I need to find the line that looks like this:

PermitRootLogin yes

change to

PermitRootLogin no

Then, change default port 22 to 1234 (up to you)

# What ports, IPs and protocols we listen for 
Port 1234

Finally, restart ssh service with

service ssh restart

Now, try to open another terminal and access to Digital Ocean with:

ssh chai@123.456.7.8 -p 1234

You can access like a root user. Well done!

Note: Use -p follow by port_number in case you change your default port


Step 3: Config DNS

This step to config DNS for mapping domain name, use domain name instead of typing ip address.

Back to your Digital Ocean Control Panel, click -> Networking -> Domains and then click Create Record

Then, Add CNAME record for www to point to ip address like this (in case user type phonbopit.com and www.phonbopit that will be the same server.

If you use Google App Mail, You can choose Select Record Type -> MX -> ADD GMAIL MX RECORD

After that, DNS Setup look like this:

Next, change your name servers from your domain registrar and change to:

ns1.digitalocean.com
ns2.digitalocean.com
ns3.digitalocean.com

In my case, I use name.com. After login, go to Account -> Domain -> DNS Record

When I finish setup I can verify that the new name servers are registered by running this command:

whois phonbopit.com

Step 4: Setup Ghost

Back to VPS, after setup DSN, now change the nginx configuration to match your domain name and ghost configuration.

setup nginx by open default.conf

vi /etc/nginx/sites-available/ghost

Change my-ghost-blog.com to yoursite.com

Next, config Ghost by open config.js

vi /var/www/ghost/config.js

Scrolling down to Production section, change

url: 'http://my-ghost-blog.com'

to your domain name

url: 'http://yourdomain.com'

Next, setup mail server for send email to you when you forgot a password, I use Mailgun, after registered, Add a new domain

After created, you need to verify ownership of your domain by adding some DNS records to you domain to more detail here this very useful article : Mailgun + DigitalOcean

Next, in /var/www/ghost/config.js add mailgun setup :

mail: {  
transport: 'SMTP',
options: {
service: 'Mailgun',
auth: {
user: 'username@mailgun.com',
pass: 'mailgunpassword'
}
}
}

Finally, restart ghost service and see your blog alive.

service ghost restart

That’s it!


Today I Learned ❤️Chai

Chai's learning journey about Web development (Node.js + React), Lifestyle, Travel and Self Improvement.

Chai Phonbopit

Written by

I make web stuff with JavaScript (Node & React), Blogger at https://devahoy.com 🤖

Today I Learned ❤️Chai

Chai's learning journey about Web development (Node.js + React), Lifestyle, Travel and Self Improvement.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade