Install & Setup (production)

How to install Ghost on your production server

This guide is intended for self hosters, looking for a step-by-step guide to getting Ghost installed, setup and configured on their own servers

If you're looking to install Ghost on your local machine, perhaps just to test it out or to develop a theme, please follow the local install guide instead. If you're looking to hack core files, or even better, contribute, please follow the instructions in Working with Ghost.

This guide will first walk you through how to setup a server with all of our recommended prerequisites. Then we'll show you how to install Ghost CLI and then how to use Ghost CLI to install and setup Ghost.

The CLI Knowledge Base contains detailed information about what Ghost CLI does, and our command reference explains all of the commands that Ghost CLI makes available to you. Finally, if you run into trouble, please see our troubleshooting guide for some solutions to common problems.

Node/Docker Clustering and other multi-server setups

Ghost does not support clustering or multi-server setups of any description, there should only be one Ghost instance per blog. The recommended scaling and performance approach is to put a cache and/or CDN in front of your blog; pages generated by Ghost are essentially static so there should be very little traffic hitting your Ghost server with a well configured cache.


We only support the official recommended installation.

All other installations are not supported and won't get support soon!

For installing on production, we officially recommend the following stack:

Please see the hosting guide for more information on the recommended stack and choosing a hosting provider.

SSL pre-requisites

If you plan to setup SSL, you will need to point your custom domain at your server & check that it is resolving before starting the install.

Minimum NGINX Version

The SSL configuration that will be setup for your ghost blog will pull in a dependency on HTTP/2 (preferred protocol) and thus default setup without modifications requires NGINX 1.9.5.

Check your NGINX version via

nginx -v

Server Setup

The following is a step-by-step guide to installing all of Ghost-CLI's pre-requisites.

Create a New User

When you first log into your new server it is highly recommended to create a new user with regular account privileges and do some basic system setup.

Don't use the ghost user

Please don't call this user ghost! Ghost-CLI will create a ghost user for managing your blog. You should never have to run any commands as the ghost user.

The user you are creating during the next steps is for administrating your server:

adduser <user>

Super User Privileges

The newly created user has regular account privileges, however, you may sometimes need to do administrative tasks. To not have to log out and in again for these tasks the user is added to the "superuser" group. This allows you to run single commands with super user privileges by using the sudo (superuser do) command.

usermod -aG sudo <user>

Log in as the new user

su - <user>

It is assumed that all following steps are executed by a non-root user. Therefore administrative tasks are shown with sudo where needed.

Basic Security

ghost-cli will create a new system user for running Ghost automatically. This user is called ghost. Ownership of the Ghost content directory will be transferred to ghost. More information can be found in the CLI Knowledge Base. This is a security measure. If Ghost gets compromised, your system would be safe.

After you have created your server, please follow this recommended tutorial to perform some additional system hardening steps (e.g.: public key authentication, firewall).

Update Packages

Before starting with the installation make sure that your package lists and the installed packages are up to date.

Update package lists

sudo apt-get update

Upgrade installed packages

sudo apt-get upgrade

Install NGINX

Install NGINX Webserver on your droplet

sudo apt-get install nginx

Open Firewall for HTTP/HTTPS

If ufw was activated we need to make sure that the firewall allows HTTP and HTTPS connections.

sudo ufw allow 'Nginx Full'

Install MySQL

The CLI installs Ghost by default with MySQL. This is our recommended database. If you would like to use Sqlite3, you can skip this step.

Install MySQL

sudo apt-get install mysql-server

Always set a root password

During mysql installation, you will be prompted to create a root password. Please be sure you specify a value for this! Leaving the root password blank will make Ghost-CLI unable to connect to the database with the error ER_NOT_SUPPORTED_AUTH_MODE.

Install Node.js

Add the NodeSource APT repository for Node 8

curl -sL | sudo -E bash

Finally install Node.js

sudo apt-get install -y nodejs

Node.js must be system wide

If you have Node.js already installed, please ensure it was installed system wide. This means Node.js was installed e.g. in /usr/bin/node or /usr/local/bin/node. You can double check where Node.js was installed with the command which node.

NVM can be problematic

If you installed node via nvm, we highly recommend that you uninstall nvm. There have been several people who have run into permission problems, because they've installed nvm in /root or /home, which is a local installation of node. Ghost requires a system wide installation.

It is not enough to symlink the local installation to /usr/bin/node.

Please uninstall nvm and any node versions installed with it:

rm -rf $NVM_DIR ~/.npm ~/.bower
unset NVM_DIR;
which node;
rm -rf {path_to_node_version}

Also look in your ~/.bash_profile or ~/.bashrc and remove any nvm lines.

Install Ghost-CLI

sudo npm i -g ghost-cli


ghost-cli@latest will ensure the latest version, handy for an upgrade or if you're not sure if you already have it installed.


After installing the ghost-cli, you should have global access to ghost in your terminal. Try ghost help.

Install Ghost via the CLI

Be prepared

If you install Ghost via the CLI for production, you need to have met the pre-requisites and installed ghost-cli.

Also, it's important to read through this guide first. This will explain all the steps the CLI will prompt you.

Create a new folder

sudo mkdir -p /var/www/ghost

Danger Zone (!)

Installing Ghost in the /root folder won't work and result in a broken setup!
Installing Ghost in your /home/{user} folder won't work and result in a broken setup!
Please only use /var/www/{folder} because it has the right permissions.

Your user must own this directory

sudo chown [user]:[user] /var/www/ghost

Where [user] is the user you created during the setup phase.

Your installation folder must have the correct permissions

sudo chmod 775 /var/www/ghost

Read more about the required permissions

You can find further information about the permission requirements for your installation folder here.

Navigate to the new folder

cd /var/www/ghost

Make sure directory is empty

You have to run ghost within the directory you would like to install Ghost. Furthermore the directory has to be empty.

Install Ghost (using Ghost-CLI)

ghost install --v1

  • This will install and start your blog in production mode using MySQL as the default database
  • If you want to install Ghost with Sqlite3, please read how here
  • Checkout our detailed prompts guide, which explains all the questions you'll be asked during install.

Ghost-CLI Knowledge Base

If you want to find out more about permissions, certificates/Let's Encrypt or system process check our CLI Knowledge Base

Ghost-CLI commands

If you want to find out more information about a specific Ghost-CLI command, check out our Ghost-CLI API page.

What to do when an install fails

Our troubleshooting guide has a list of potential errors and how to deal with them. If an install goes horribly wrong, you can use ghost uninstall to remove it and try again.

Using ghost uninstall is preferable to deleting the folder, as it will ensure there are no artefacts left behind.

Ghost Admin + Cloudflare

If Ghost admin isn't loading for you, and you have Cloudflare enabled, please read this.

Install & Setup (production)

How to install Ghost on your production server