An adventure with Ghost I: Installing Ghost on a VPS with Nginx

ghost-logo

A few days ago I published an entry about how to install Ghost easily with an installation script, today I write this to teach how to install it with Nginx and your domain name. Without further ado, let's get started with the tutorial!

Required packages


To install Ghost In VPS we have to connect to it and install the dependencies, for this we need to install the following:

# apt-get install build-essential automake make checkinstall dpatch patchutils autotools-dev debhelper quilt fakeroot xutils lintian cmake dh-make libtool autoconf git-core curl zip nginx

This will install the dependencies to compile NodeJS (required by ghost), will install Nginx and other tools.

Compiling NodeJS


To compile NodeJS we must download the sources:

wget http://nodejs.org/dist/node-latest.tar.gz

Once this is done, you have to unzip them:

tar -xzf node-latest.tar.gz

We move to the directory where the code is located:

nodeversion=`ls | grep node`
cd $nodeversion

We compile and install:

./configure
make -s
make install

And that's it!

Installation


Before configuring, you have to install it, right? Although of course, do not panic, you will no longer compile 🙂

Create the www directory and move to it:

Note: Before starting the whole tutorial, keep in mind that you have to uninstall any server that occupies port 80, 8080 and the www folder, if the folder exists, delete it.

mkdir -p /var/www
cd /var/www/

Download Ghost:

curl -L -O https://ghost.org/zip/ghost-latest.zip

Unzip:

unzip -d ghost ghost-latest.zip
rm ghost.zip

Enter the directory:

cd ghost/

Move everything to / var / www /:

mv /var/www/ghost/* /var/www/

Go back to / var / www /:

cd /var/www/

Install Ghost

/usr/local/bin/npm install --production

Good! Now to configure. 😀

Configuration

We edit the configuration file with the following command:

sed -e 's/127.0.0.1/0.0.0.0/' -e 's/my-ghost-blog.com/www.dominio.com/' -e 's/2368/8080/' config.js

Easy right? Just replace "domain.com" with your domain, for example:

sed -e 's/127.0.0.1/0.0.0.0/' -e 's/my-ghost-blog.com/www.theworldofthegeek.com/' -e 's/2368/8080/' config.js

We could do it with dwarf (the GNU editor, not to be confused with Nano's DesdeLinux : V), but it would be more complicated and we would have to replace a lot (yes, a lot, as you read it) code, but this way to explain is easier :).

But remember we need it to be in the background! For this we install forever:

/usr/local/bin/npm install -g forever

We introduce the following command (to start Ghost We must be in the installation directory (/ var / www /)):

NODE_ENV=production forever start index.js

Ta dah! In background!

To stop, restart or start Ghost:

forever stop index.js
forever restart index.js
NODE_ENV=production forever start index.js

Ready! 😀

Setting up Nginx


Time to configure Nginx!

We will edit the configuration file:

nano /etc/nginx/nginx.conf

We will delete everything and paste the following configuration: http://paste.desdelinux.net/5034

Once with the new settings, replace the word "domain" with your domain name on lines 36, 38, 39 and 43.

Now reboot Nginx

service nginx restart

Ready! 😀

Configure the domain


Enter your domain provider and edit the A (Host) record. Change the IP address it points to for your VPS, and voila!

End Notes


To access the administration, go to www.dominio.com/ghost/ remember to change domain for your domain. Ready! You can now access your domain, start publishing and install a theme :), but ...

The World Of The Geeks (I) give you this theme for you to install, modify and enjoy. 🙂

You just have to download it:

wget http://www.theworldofthegeek.com/files/TWOTGFlat.zip

Unzip it:

unzip TWOTGFlat.zip

And copy the theme to your Ghost

cp TWOTGFlat/ /var/www/content/themes

Now in the settings of your Ghost change the theme to the new one, and voila!

If you have a question or need help with Ghost, leave your questions in the comments or you can contact me on my website.

Cheers! nn /


Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   thalskart said

    Good tutorial, I'm going to test it on the "play" VPS, you won't have a preview of the theme to see how it is before downloading it 😛

    1.    XTickXIvanX said

      Sure! http://www.theworldofthegeek.com/content/images/2014/Aug/Captura-de-pantalla-de-2014-08-09-17-04-57.png
      You just have to modify the default.hbs (since it has a minor error in the navbar) and the sidebar.hbs and that's it!

      1.    thalskart said

        Thank you!!

  2.   eliotime3000 said

    Interesting tutorial. Perhaps, I dedicate myself to migrating to Ghost, but I don't know how the management would be there (in fact, if it requires access to the VPS, it would be somewhat uncomfortable).

    1.    XTickXIvanX said

      There are tools to migrate to Ghost from for example WordPress, it is very easy to control, from tusite.com/ghost you access the administration of Posts, user and blog, unfortunately it does not have multi-user support (But it will be added), but with some Hacks to code can be done, although personally I prefer to wait for updates to avoid making mistakes, if you have questions ask me 🙂

      1.    eliotime3000 said

        Well, in any case, I'd like to try Ghost's multi-user management.

      2.    XTickXIvanX said

        And now you can do it!
        Ghost already supports multi-user 😀

  3.   Javier Madrid said

    I would like to know what ghost offers as a platform or blogging that others do not. They have made it known here and also how to install and configure but, they have not mentioned why to use ghost. For example, currently I think WordPress takes the crown in this type of platform, the question would be why use ghost and not wordpress? Or is it simply being an alternative, just that?

    1.    Jorge said

      +1. I would like more information about it, because little is known about Ghost.

      I was looking at my hosting and I realized that Softaculous offers it to install it, but I do not see advantages over WordPress.

      The only thing I have seen is that Ghost is more minimalist, perhaps that provides some advantage over the server load.

      1.    XTickXIvanX said

        Actually the server load is much faster and uses less resources

    2.    XTickXIvanX said

      I will explain that in the next article 😉

  4.   raalso7 said

    And one thing that I still haven't understood ... What is Ghost? For a blog? For a domain? ...

    1.    elav said

      To create a blog

  5.   elav said

    Great. Now there are only a few screenshots left to see what Ghost looks like on the outside and inside

    1.    eliotime3000 said

      That same. Just a few screenshots to illustrate the procedure and everyone is happy. #LOL.

    2.    XTickXIvanX said

      Man, that's the next thing 😀