Install Ghost Blog With Lighttpd and Mariadb

Introduction:

Ghost is a blogging platform which run on nodejs. I have tested this in a Ubuntu-12.04 64bit- 128mb/128mb openvz vps. Ghost requires Node.js 0.10.x (latest stable). Recommended Node.js 0.10.30 & npm 1.4.21.
Objective:

We will install nodejs, npm, lighttpd, mariadb for ghost blog. Lighttpd is for reverse proxy for ghost blog and it is really light enough to run smoothly on small vps boxes. Mariadb for saving posts as it is better than Mysql in some cases and also optimized for good performance. A benchmark of Mysql vs Mariadb. We will also install sendmail for ghost blog to act as a fully functional blog.

Installation Procedure:

1st Step: Nodejs – Npm

Let us install nodejs and npm as ghost blog build to run on this. We need repository to install latest versions.
First install curl and nano to download and edit files and also unzip to extract files.

Then let’s use curl to get repository. This command will add repository and will let us to download/install latest nodejs.

After running above command we can now install nodejs.

Check the versions.

 2nd Step: Lighttpd and Mariadb

Install the repo manager to use “add-apt-repository” command.

Import the GnuPG signing key

Add repository.

Update Source and install:

Now create a database.( It will ask you for root database password.)

 3rd Step: Ghost

Let we will install ghost in a domain “domain.com”, so we will create folder.

Now enter into that folder.

Now we will download the zip file by which we will install ghost. (Latest) in this folder.

Now let’s extract the zip file into a directory.

Above unzip command will extract ghost blog to a folder “ghost”, enter ghost directory.

Now have to run below code as we will run our blog in production mode. This command will get the dependencies.

We have to configure config file by our choice. Let’s replicate the sample config file to config.js-

Now edit that config file by our need.

Find // ### Production. This is the start of Production based configuration. Also find // Developers only need to edit below here and above this line end of Production based configuration. You can just delete all from that and paste below codes which is good enough with sendmail and database.

 

Change that domain with yours and change database section like above with the latest created database and add the server/vps ip in 127.0.0.1 and save it. In database connection do not use localhost, use 127.0.0.1 instead.
Now let’s test the ghost and nodejs server.

the oputput should be something like this

So it is running but we will not be able to browse by that domain yet. We have to use http://domain.com:2368 as ghost or nodejs run by ports and we installed ghost in 2368 port.

 

4th Step: Start Script

Create a blank file as ghost.conf in /etc/init/ folder.

Edit that file by nano and put below code.

Change the location And save that file. Now you can start and stop the service by simply running below command.

 

This will also act as an auto start configuration file when reboot the server.

5th Step: Lighttpd and Virtualhost

Edit /etc/lighttpd/lighttpd.conf and pur below codes in the bottom of that config file. But remember to change the ip and domain name and directory name.

Save the file and run below command-

Then restart lighttpd server. Above command for enabling proxy feature of lighttpd server.

Now you can access your blog by the domain name only.

Final Step:

Make sure you restarted the service accurately.

Now you will be able to register and use your very fast blogging platform. 🙂

Conclusion: We have installed successfully our beloved ghost blog with sendmail function and mariadb+lighttpd. This box is 128mb openvz and it’s running smoothly.

ghost_in_lighttpd

I have also tested the server by Apache Benchmark. It just doesn’t bother. 🙂
You can tweak mysql/mariadb and lighttpd to give it a fast reaction capability. A good optimised lighttpd+mysql will give you a breeze with ghost blog and your small vps. You can find some interesting post in this site about how to tweak mysql for better traffic handling.
Happy Blogging !

22 comments for “Install Ghost Blog With Lighttpd and Mariadb

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.