Build a ghost Blog based on Nodejs on CentOS

Source: Internet
Author: User
Tags install node

Ghost Introduction
Ghost 是基于 Node.js 构建的开源博客平台。Ghost 具有易用的书写界面和体验,博客内容默认采用Markdown 语法书写。Ghost 的目标是取代臃肿的 Wordpress。
Build Ghost Blog System

1. Native test environment

[[email protected] ~]# cat /etc/redhat-releaseCentOS Linux release 7.2.1511 (Core)[[email protected] ~]# uname -r3.10.0-514.26.2.el7.x86_64

2. Install node. js

#更新yum源[[email protected] ~]# yum update -y#安装软件组包Development Tools[[email protected] ~]# yum groupinstall -y "Development Tools"#安装NodeSource Node.js 6.x repo[[email protected] ~]# curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -#yum安装 nodejs[[email protected] ~]# yum -y install nodejs#npm国内镜像(npm是随同NodeJS一起安装的包管理工具)[[email protected] ~]# npm config set registry https://registry.npm.taobao.org#安装cnpm模块(因为国内网络的关系,也同时安装了 cnpm 模块,后续将使用该命令代替 npm 命令。)[[email protected] ~]# npm i -g cnpm

#通过node-V and NPM-V commands to see if the installation was successful.

3., install Ghost
① Installing Ghost Client (GHOST-CLI)

[[email protected] ~]# cnpm i -g ghost-cli#安装成功后通过运行 ghost -v,出现版本号即可表示安装成功。[[email protected] ~]# ghost -vGhost-CLI version: 1.7.1

② add Ghost to run the user and create the directory

[[email protected] ~]#  adduser ghost[[email protected] ~]#  mkdir /var/www[[email protected] ~]#  mkdir /var/www/ghost[[email protected] ~]#  chown ghost /var/www/ghost

③ Installing the SQLite3 database

#新版本不允许root用户安装,需要切换普通用户进行安装。[[email protected] ~]# su - ghost [[email protected] ~]$  cd /var/www/ghost[[email protected] ~]$ ghost install local --db=sqlite3

④ Start Ghost
After the installation is successful, Ghost is started by default.

# 停止host[[email protected] ghost]$ ghost stop# 启动ghost[[email protected] ghost]$ ghost start#重启ghos[[email protected] ghost]$ ghost restart

After successful installation, the default is run on http://localhost:2368/
You can access it as follows:
[Email protected] ghost]$ Curl http://localhost:2368/

4. Installation of Nginx and integrated Nodejs

[[email protected] ghost]$ su - root[[email protected] ~]# yum install -y nginx#启动 Nginx[[email protected] ~]# systemctl start nginx.service#查看nginx是否运行[[email protected] ~]# ps -ef|grep nginx#查看是否启动成功 http://你的ip

#设置开机自启动[[email protected] ~]# systemctl enable nginx.service#整合nodejs[[email protected] ~]#cp /etc/nginx/nginx.conf  /etc/nginx/nginx.conf.ori[[email protected] nginx]# vi /etc/nginx/nginx.conf +47 server { ···        location / {        proxy_pass http://127.0.0.1:2368;        proxy_redirect default;        root   /usr/share/nginx/html;        index  index.html index.htm;        }                ···[[email protected] nginx]# nginx -s reload             

4. Visit the Built Ghost Blog
Front page: http//Your ip/

Background login page:/HTTP//Your Ip/ghost

Background Management page:

The above construction process I personally operate available, there are questions to comment, time to answer, feel useful point of praise, support the author!

Build a Nodejs-based ghost blog on CentOS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.