/ tech

How to install Ghost on AWS EC2, GCE, or any other server

To install ghost on your AWS EC2, your GCE VM, or any other server simple follow these steps.


First of all, we'll install node.js, a JavaScript runtime built on Chrome's V8 JavaScript Engine.

To install node on a server, use NVM to easily manage all the different versions:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

After the installation, get the desired version (for Ghost, use v6.5.0)

nvm install 6.5.0
nvm use 6.5.0
nvm alias default 6.5.0

Verify with:

node --version


Now let's get Ghost up and running. Installing ghost-cli helps us to install and update our blogs.

npm install -g ghost-cli

Create a directory for your blog, e.g.

mkdir ~/ghost

And install Ghost via ghost-cli:

cd ~/ghost
ghost install local

✔ Checking for latest Ghost version
✔ Running system checks
✔ Setting up install directory
✔ Downloading and installing Ghost v1.0.0-beta.2
✔ Moving files
✔ Configuring Ghost
ℹ Running setup checks [skipped]
✔ Setting up instance
✔ Running database migrations
✔ Validating config
✔ Starting Ghost
You can access your blog at http://localhost:2369/

Ghost uses direct mail by default
To set up an alternative email method read our docs at https://docs.ghost.org/docs/mail-config


Don't run your Ghost directly at Port 80 but use NGiNX in front of it.

We do not recommend configuring Ghost to run on port 80 directly, as this requires Ghost to be run as a root level user and is a security risk. Always run Ghost with a web server, both NGINX and apache work, we recommend and document how to use NGINX.


sudo apt install nginx

Create your config:

sudo vim /etc/nginx/sites-available/ghost.conf


server {
listen 80;
server_name ghost.oceanbased.ch;

 location / {
     proxy_set_header   X-Real-IP $remote_addr;
     proxy_set_header   Host      $http_host;

Symlink the config and restart the server:

sudo ln -s /etc/nginx/sites-available/ghost.conf /etc/nginx/sites-enabled/ghost.conf
sudo service nginx restart


That's it - now access your blog via IP or the name you entered in the config.

Read this article to get a guide on how to protect your site with SSL using a free certifcate from Let's Encrypt.

How to install Ghost on AWS EC2, GCE, or any other server
Share this