Configuring Ghost / Node.js for Lightning Performance

HTML5 | JavaScript | Node 11 11 Comments

Ghost is a brand new blogging platform written on Node.js. For all you JavaScript people, you know what that means. It’s open source, and it’s on Github, but before you go running off to gawk at the source, here’s how to install it for optimal performance. Don’t worry, it only takes a few minutes:

Set up your domain name

NameCheap is my favorite registrar. I can’t remember how long I’ve been using them, but it’s a looooong time, and they have treated me very well. Support is very responsive, and the domain management console is great. You’ll need to use that to set up your DNS, later. Yeah, that’s an affiliate link, but I really do use them, and I really do love them. I wouldn’t use anybody else.

Set up your hosting

Create a $5/month DigitalOcean droplet (the smallest size should work great for most blogs). Why DigitalOcean? First, they have Ghost on Ubuntu pre-installed. Under “Select an Image -> Applications -> Ghost 0.3.2 on Ubuntu 12.04″.

Most importantly, they’re fast. Really, really fast. Their drives are all SSDs. Their awesome virtual machines protect you from interference by other users of the system — both hacking, and system hogging. The price is right, too. Lots of power for very little money.

And they have an affiliate program. If you get one other person per month to sign up for DigitalOcean, your hosting is free. (Disclaimer, that link is an affiliate link, but I would never link to them if I didn’t use them and love their service.)

Set up your mailer

Head on over to Mailgun.com and set up a free account. Yeah, totally free up to 10,000 emails/month. Awesome. After that it’s only $0.50 / 1000 for the next 500,000 emails. A bargain compared to dealing with the headache of making sure your email stays deliverable with a high-traffic system. Believe me, the man hour trade-off is worth the price.

Set up your DNS

This step is the grease on your lightning.

I recommend that you do this with CloudFlare. CloudFlare started out as a website security company that monitors and filters out malicious traffic to your website, but they worried that it would slow people down, so they invested a lot of time and effort figuring out how they could counteract that. The result is they created a killer caching CDN service that has improved my page load times by 60%, and it’s free. I can’t fathom why they offer so much goodness for free, but they do, and you’d be missing out if you passed them over.

This step is really going to be done at the same time as your mailer, because when you set up your hostname with Mailgun, they’re going to give you a bunch of DNS records to add. Add them in Cloudflare, click the big green button at the bottom, and you’re all set.

Go back to Namecheap (or your existing registrar) and enter the Nameservers that you get from CloudFlare.

Log into your server and edit the config

These steps are covered really well in DigitalOcean’s “How to Use the DigitalOcean Ghost Application”. Read that next.

You’ll need to configure your mailer. It should look something like this:

How to hack ghost

Themes are really simple mustache style templates. Anybody familiar with HTML should be able to pick it up quickly. The first thing you’ll probably want to do is add support for comments. But themes are only skin deep. The really great thing about Ghost is that anybody familiar with JavaScript can do some real hacking on it:

Go to the Ghost Github account and browse the source. Ghost is an Express app with a Backbone.js front end. The meat of the server app is in core/ghost.js.

The source code is really clean and readable (and small!), and relies heavily on promises to manage data dependencies. If you want to contribute to core, you should grab the Ghost Vagrant distribution.

Buckle your seatbelt

Ghost on DigitalOcean with CloudFlare’s performance optimization may just be the fastest blogging setup ever. It’ll outperform most static file servers. You should see returns in lower bounce rates.

What’s next

Ghost is brand new, which means there isn’t a lot out there for it, yet. Start hacking on themes and plugins. I’d love to see a simple plugin management system that uses npm, and automatic updates. Let’s make this the best blogging platform out there.


  1. CloudFlare is providing 3TB of free bandwidth a month for my static files.

  2. Hopefully that’s not your real Mailgun password in the example. It kinda looks like a real password.

    P.S. Your “Contact” form doesn’t work because of the Captcha.

    Cheers.

    • Eric Elliott - October 17, 2013

      No, that’s not my password.

      And I know about the contact form. The quiet inbox has been nice. ;)

      • I can confirm that it is not his MailGun password because it was copied from my sample config.js file.  ;)

        Eric,  now that you have had this setup for a while can you give us an idea of the performance benefits of Ghost with and without CloudFlare?    Possibly average page load times and number of requests?  I am very curious to hear how Ghost and CloudFlare play together.  

        • Eric Elliott - November 12, 2013

          It’s about 40% faster for me, but that will vary a great deal depending on how many static assets you’re offloading to CloudFlare. BTW, I’m planning to migrate all my blogs to this setup. It’s just going to take some time to do the conversions.

  3. dman777 - December 29, 2013

    I would recommend Rackspace to host these blogs. They already have a pre-deployment for Node.js, they use SDDs also(in addition to raid 10 backups), they own Mailgun(also free), and you are given the CloudFlare account/service for Free! 

    • dman777 - December 30, 2013

      Actually, I just found out Rackspace also has a pre-deployment which is Single Linux server with Ghost 0.3.3, Nginx, Node.js, and MySQL 5.5. Nice!

    • Eric Elliott - February 12, 2014

      Except for owning Mailgun, DigitalOcean shares all those advantages, they’re also less expensive, and easier to work with. I was a Rackspace customer before I was a DigitalOcean customer. They’re a great company with great service, but I think DigitalOcean has got the magic right.

  4. Hi, I have noticed that occasionally this page renders a 500 server error message. I figured you would like to know. Regards

    • Eric Elliott - March 7, 2014

      Yeah. Sadly, this blog is still stuck on my old shared hosting provider for the time being. I’m planning to move it to the DigitalOcean/Ghost setup described above as soon as I have time.

Add Comment Register



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">