---
title: 'Ghost on Pi'
url: 'https://darryldias.me/blog/ghost-on-pi'
markdown: 'https://darryldias.me/blog/ghost-on-pi.md'
date: '2015-09-19'
description: 'Ghost is an open-source blogging platform written in Node.js that offers both self-hosted and fully hosted services. In this guide, we are going to self-host Ghost on a Raspberry Pi. This will take you through the steps of setting up a self-hosted Ghost production environment. I am working on this …'
taxonomy:
  category:
    - blog
  tag:
    - pi
    - linux
    - guide
    - ghost
---

September 19, 2015 [pi](https://darryldias.me/tag:pi) 

#  Ghost on Pi 

  ![Darryl Dias](https://darryldias.me/images/4/a/2/b/9/4a2b98d4a128921dbd04599ed25fc08acdf72c66-darrylavatar.png)Darryl Dias

It takes only 2 minute read this article.

    Listen to this article

 AI voice: Sadaltager • Click play to generate 

 0:00

 --:-- 

[Ghost](https://ghost.org) is an open-source blogging platform written in [Node.js](https://nodejs.org) that offers both self-hosted and fully hosted services.

In this guide, we are going to self-host Ghost on a Raspberry Pi. This will take you through the steps of setting up a self-hosted Ghost production environment.

I am working on this setup with a clean install of Raspbian in a headless setup. You can learn how to enable SSH [here](https://www.raspberrypi.org/documentation/remote-access/ssh/).

Mac and Linux users can SSH directly into the Raspberry Pi via the terminal. If you are a Windows user, you will need to use [PuTTY](http://www.putty.org/).

```bash
ssh pi@the-ip-address-of-the-pi

```

The default username and password for a fresh Raspbian install is:

- **User:** pi
- **Password:** raspberry

#### Installing Node.js & Dependencies

First, download Node.js (NPM ships with it):

```bash
wget http://node-arm.herokuapp.com/node_latest_armhf.deb

```

Install Node.js (required by Ghost):

```bash
sudo dpkg -i node_latest_armhf.deb

```

Install SQLite (the database used by Ghost):

```bash
sudo apt-get install sqlite3

```

Install NGINX (used as a reverse proxy for Ghost):

```bash
sudo apt-get install nginx-full

```

Install Supervisor (used to keep Ghost running in the background):

```bash
sudo apt-get install supervisor

```

#### Ghost Setup

Download the latest version of Ghost:

```bash
wget https://ghost.org/zip/ghost-latest.zip

```

Unzip the downloaded folder:

```bash
unzip ghost-latest.zip -d Ghost

```

Set `Ghost/` as the current directory:

```bash
cd Ghost/

```

Install the dependencies used by Ghost via NPM:

```bash
npm install --production

```

Run the command below to ensure everything works properly:

```bash
npm start --production

```

#### Running Ghost as a Service

Now it's time to turn Ghost into a background service.

Create a `ghost.conf` file for Supervisor to manage Ghost:

```bash
sudo touch /etc/supervisor/conf.d/ghost.conf

```

Open the file in your preferred text editor (like nano):

```bash
sudo nano /etc/supervisor/conf.d/ghost.conf

```

Add these lines to the `ghost.conf` file:

```ini
[program:ghost]
command = npm start --production
directory = /home/pi/Ghost/
user = pi
autostart = true
autorestart = true
stdout_logfile = /var/log/supervisor/ghost.log
stderr_logfile = /var/log/supervisor/ghost_err.log
environment = NODE_ENV="production"

```

Save and exit the file (in nano, press `CTRL` + `X`, then `Y`, and `Enter`).

Start Supervisor, if it did not start automatically after installation:

```bash
sudo service supervisor start

```

Set Supervisor to run automatically on startup:

```bash
sudo update-rc.d supervisor defaults

```

Start the Ghost service we just created:

```bash
sudo supervisorctl start ghost

```

Ghost is now running in production on port 2368.

#### Reverse Proxying Ghost with NGINX

Open your NGINX `default` configuration file:

```bash
sudo nano /etc/nginx/sites-enabled/default

```

Replace its contents with the following lines:

```nginx
server {
    listen 80;
    server_name yourdomain.com; # Change this to your hostname

    location / {
        proxy_pass http://127.0.0.1:2368;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

```

Save and exit the file, then restart NGINX:

```bash
sudo service nginx restart

```

Now, visit your Raspberry Pi's IP address in your web browser. You will be presented with a beautiful setup screen.

You can edit the Ghost hostname and other settings by modifying the `config.js` file stored inside your `Ghost` directory. Services like [DynDNS](https://dyndns.org) can be used to manage your hostname if you want your Ghost blog to be public and use a domain name instead of an IP address.

If you have any questions or run into problems, leave a comment below!

 [pi](https://darryldias.me/tag:pi) [linux](https://darryldias.me/tag:linux) [guide](https://darryldias.me/tag:guide) [ghost](https://darryldias.me/tag:ghost) 

 Share: [X / Twitter](https://twitter.com/intent/tweet?url=https%3A%2F%2Fdarryldias.me%2Fblog%2Fghost-on-pi&text=Ghost%20on%20Pi) [Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdarryldias.me%2Fblog%2Fghost-on-pi) [LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fdarryldias.me%2Fblog%2Fghost-on-pi&title=Ghost%20on%20Pi) [Reddit](https://reddit.com/submit?url=https%3A%2F%2Fdarryldias.me%2Fblog%2Fghost-on-pi&title=Ghost%20on%20Pi) [Email](mailto:?subject=Ghost%20on%20Pi&body=https%3A%2F%2Fdarryldias.me%2Fblog%2Fghost-on-pi) 

## Related articles

 [ January 16, 2021 3D Artist using Linux ](https://darryldias.me/blog/3d-artist-using-linux) [ December 18, 2024 5 Things to do after installing Fedora ](https://darryldias.me/blog/5-things-to-do-after-installing-fedora) [ January 26, 2019 10 Powerful Zig Ziglar Quotes ](https://darryldias.me/blog/10-powerful-zig-ziglar-quotes)

---

## Navigation

- Parent: [Home](https://darryldias.me/index.md)
- Previous: [App Review: Pocket](https://darryldias.me/blog/app-review-pocket.md)
- Next: [Live tile for Jekyll](https://darryldias.me/blog/live-tile-for-jekyll.md)
