• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

Nginx Reverse Proxy with Ghost on Ubuntu 14.04

How VPS by How VPS
January 1, 2020
in Linux
0
0
SHARES
20
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Prepare the server: Update packages, Install Node.js and NPM
  2. Installation: Ghost and Nginx
  3. Finally: Start Ghost Automatically
  4. Want to contribute?


Ghost is a free and open source blogging platform written in node.js, completely customizable and dedicated for publishing.

Prepare the server: Update packages, Install Node.js and NPM

We’ll demonstrate the installation by logging into the server as root, so that we will not need to add sudo before each command. If you are logged as another user, remember that you will need sudo.

On your server, run the following to update the package index, upgrade packages, and install nodejs and npm.

apt-get update
apt-get upgrade

apt-get install python software-properties-common gcc g++ make -y  # auto install
add-apt-repository ppa:chris-lea/node.js -y

The output from these commands should be similar to:

gpg: keyring `/tmp/tmpvpe2ugzj/secring.gpg' created
gpg: keyring `/tmp/tmpvpe2ugzj/pubring.gpg' created
gpg: requesting key C7917B12 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpvpe2ugzj/trustdb.gpg: trustdb created
gpg: key C7917B12: public key "Launchpad chrislea" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

Automatically, the package signing key will be added to the keyring (so that the packages downloaded can be verified), and the PPA will be added to APT’s sources.list.d.

Now, let’s run:

apt-get update  # again 
apt-get install nodejs -y

Run npm to test the installation. You will see npm‘s usage printed to the screen:

Usage: npm <command>
...
...
[email protected] /usr/lib/node_modules/npm

Now we can install Ghost.

Installation: Ghost and Nginx

Since Ghost is now considered “stable”, it can be installed through npm. Install with the following command:

npm install -g ghost --production

Ignore any warnings for now.

Next, we will start Ghost and check if it’s working properly.

cd /usr/lib/node_modules/ghost
npm start --production

Output should look like this:

> [email protected] start /usr/lib/node_modules/ghost
> node index

Migrations: Database initialisation required for version 003
...
Migrations: Complete
Ghost is running... 
Your blog is now available on http://my-ghost-blog.com 
Ctrl+C to shut down

It works! Use Ctrl-C to shut down Ghost, and move on to the next step: installing (and configuring) Nginx.

Nginx is very simple to install. Run the following command:

apt-get install nginx

Nginx will be configured to allow connection from anywhere in the wild to port 80 (or 443, if using SSL) on your server, which is then forwarded (“proxied“) to Ghost. This is how people connect to your blog.

Configuring Nginx is not that hard, either. Follow these steps to configure the Ghost proxy.

First, remove the default configuration file:

cd /etc/nginx/
rm sites-enabled/default

Then, make a new configuration file:

cd sites-available
touch ghost

Adapt the following lines to your need and use something like nano or vi to paste it in (you’ll need to set server_name to your domain name):

server {
    listen 80;
    server_name yourdomain.tld;
    access_log /var/log/nginx/yourdomain.tld.log;  # if you want logging

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header HOST $http_host;       
        proxy_pass http://127.0.0.1:2368;
        proxy_redirect off;
    }
}

Symlink your configuration file:

cd /etc/nginx
ln -s sites-available/ghost sites-enabled/ghost

Restart Nginx:

service nginx restart

At this point, Nginx is installed, configured, and running on your server.

Finally: Start Ghost Automatically

Supervisor is a process control system which allows you to run Ghost at startup without using init scripts. We will be installing Supervisor to manage Ghost.

To install Supervisor, run:

apt-get install supervisor
service supervisor start

Then, create a new script file in /etc/supervisor/conf.d/ghost.conf. Paste in these contents:

[program:ghost]
command = node /usr/lib/node_modules/ghost/index.js
directory = /usr/lib/node_modules/ghost
user = ghost
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 close the file.

Next, we need to create a user for Ghost and give it permissions to access the Ghost files and database. Run the following commands:

useradd ghost
chown -R ghost /usr/lib/node_modules/ghost/
supervisorctl reread
supervisorctl update

Our setup is complete!

Now you can control Ghost by executing supervisorctl start ghost and supervisorctl stop ghost.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How to Install Gitea on Fedora 29

Next Post

Install MediaWiki on the One-Click LEMP Application

Next Post

Install MediaWiki on the One-Click LEMP Application

Leave a Reply Cancel reply

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

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet