• 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 CentOS

How to Deploy Ghost on CentOS 7.3

How VPS by How VPS
October 1, 2019
in CentOS
0
0
SHARES
15
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Using a Different System?
  2. Let’s Encrypt (Certbot)
  3. Install NodeJS
  4. Install Nginx
  5. Install Ghost
  6. Run Ghost persistently
  7. Conclusion
  8. Want to contribute?

Using a Different System?

  • How to Deploy Ghost on Ubuntu 16.04

  • How to Deploy Ghost on Debian 8.7

  • How to Deploy Ghost on Fedora 25

  • How to Deploy Ghost v0.11 LTS on Ubuntu 16.04

Are we missing a guide for your target system? Request one, or submit your own!


Ghost is an open source blogging platform that is gaining popularity among developers and ordinary users since its 2013 release. It puts focus on content and blogging. The most attractive thing about Ghost is its simple, clean, and responsive design. You can write your blog posts from a mobile phone. Content for Ghost is written using the Markdown language.

In this guide we are going to set up and deploy a secure Ghost blog on an CentOS 7 VPS using Let’s Encrypt, Node.js and Nginx.

Let’s Encrypt (Certbot)

Before starting this step, ensure that you have set DNS records for your domain.

We are going to use Let’s Encrypt Certificate Authority and its Certbot client to obtain TLS certificates for our Ghost blog. Don’t forget to replace all instances of example.com with your domain name.

  1. Update system:

    yum check-update && yum update
    
  2. Install development tools:

    yum groupinstall -y 'Development Tools'
    
  3. Enable the EPEL (Extra Packages for Enterprise Linux) repository.

    # Certbot is packaged in EPEL (Extra Packages for Enterprise Linux). To use Certbot, you must first enable the EPEL repository.
    yum install -y epel-release
    
  4. Install Certbot (a.k.a Let’s Encrypt client):

    yum install -y certbot
    
  5. Check version:

    certbot --version
    # certbot 0.9.3
    
  6. Obtain certificate:

    certbot certonly -d example.com -d www.example.com --email [email protected] --agree-tos --standalone
    

After going through previous steps, your certificate and private key will be in the /etc/letsencrypt/live/example.com directory.

Install NodeJS

Ghost currently supports Node versions 0.12.x, 4.2+, and 6.9+ only.

We are going to install recommended version for Ghost which is Node v4.x argon LTS at the time of this writing.

  1. Download and install the LTS version of Node.js:

    curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
    yum --disablerepo "*" --enablerepo "nodesource" install -y nodejs
    
  2. Check Node and NPM version:

    node -v && npm -v
    # v4.7.2
    # 2.15.11
    

Install Nginx

  1. Run vi /etc/yum.repos.d/nginx.repo and copy/paste the below directives and save and exit:

    [nginx]
    name=nginx repo
    baseurl=https://nginx.org/packages/mainline/centos/7/$basearch/
    gpgcheck=0
    enabled=1
    
  2. Download and install Nginx:

    yum install -y nginx
    
  3. Check Nginx version:

    nginx -v
    # nginx version: nginx/1.11.8
    
  4. Start Nginx process and check status:

    systemctl start nginx
    systemctl status nginx
    
  5. Configure Nginx as a reverse proxy:

    vi /etc/nginx/conf.d/ghost.conf
    
  6. Add the following to /etc/nginx/conf.d/ghost.conf:

    server {
        listen 80;
        listen [::]:80;
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name example.com www.example.com;
    
        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    
        location / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_pass http://127.0.0.1:2368;
        }
    }
    
  7. Check syntax:

    nginx -t
    
  8. Restart Nginx:

    systemctl restart nginx
    

Install Ghost

If you want to host multiple Ghost blogs on same VPS, each Ghost instance must be running on a separate port.

  1. Make webroot directory:

    mkdir -p /var/www/
    
  2. Create a Ghost user:

    useradd -c "Ghost Application" ghost
    
  3. Download and install Ghost:

    cd /var/www
    wget https://ghost.org/zip/ghost-latest.zip
    unzip ghost-latest.zip -d ghost
    chown -R ghost:ghost /var/www/ghost/
    rm ghost-latest.zip
    
  4. Switch to the ghost user:

    su - ghost
    
  5. Install Ghost:

    cd /var/www/ghost
    npm install --production
    
  6. Configure Ghost by changing url property of production object inside of config.js file:

    cp config.example.js config.js
    
    vi config.js
    
    config = {
        // ### Production
        // When running Ghost in the wild, use the production environment.
        // Configure your URL and mail settings here
        production: {
            url: 'https://example.com',
            ...
        }
        ...
        ...        
    
  7. Save config.js file and exit.

  8. Start Ghost:

    npm start --production
    

Ghost will now be running. Both blog front-end and admin interface are secured with HTTPS and HTTP/2 is working also. You can open your browser and visit site at https://example.com. Don’t forget to replace example.com with your domain name.  

Run Ghost persistently

If you close your terminal session with your VPS, your blog will also go down. That’s not good. To avoid this, we are going to use the Forever process manager. That will keep our blog up 24/7.

  1. Switch to ghost user if you are not:

    su - ghost
    
  2. Go to ghost folder

    cd /var/www/ghost
    
  3. Install Forever process manager:

    npm install forever
    
  4. Add the new forever command to your path:

    echo "export PATH=/var/www/ghost/node_modules/forever/bin:$PATH" >> ~/.bashrc
    source ~/.bashrc
    
  5. Start Ghost with forever:

    NODE_ENV=production /var/www/ghost/node_modules/forever/bin/forever start index.js
    

      At this point, forever should have started Ghost.

  6. Go to https://example.com/ghost and create a Ghost admin account. Do this as soon as possible. To check running version of Ghost go to https://example.com/ghost/about/ after creating admin account.

Conclusion

That’s it. We now have a fully functional Ghost blog. If you want to change the default Ghost theme called Casper to a custom one, you can just download and unzip the theme into the /var/www/ghost/content/themes folder and select it via Ghost admin interface, located at https://example.com/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 Use Mosh on CentOS 7 for Remote Server Administration

Next Post

Setup Zarafa and Yaffas on CentOS 6

Next Post

Setup Zarafa and Yaffas on CentOS 6

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