Ghost简介
Ghost 是基于 Node.js 构建的开源博客平台,由前 WordPress UI 部门主管 John O’Nolan 和 WordPress 高级工程师 Hannah Wolfe 创立。Ghost 具有易用的书写界面和体验,博客内容默认采用Markdown 语法书写。Ghost 的目标是取代臃肿的 Wordpress。目的是为了给用户提供一种更加纯粹的内容写作与发布平台
安装cnpm模块(因为国内网络的关系,也同时安装了 cnpm 模块,后续将使用该命令代替 npm 命令。)
npm i -g cnpm
安装 Ghost
安装 Ghost Client (ghost-cli)
cnpm i -g ghost-cli
ghost -v
添加 Ghost 运行用户并创建目录
useradd ghost
mkdir /data/ghost
chown -R ghost.ghost /data/ghost/
安装SQLite3 数据库
新版本不允许root用户安装,需要切换普通用户进行安装。
su - ghost
cd /data/ghost/
ghost install local --db=sqlite3
✔ Checking system Node.js version
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v2.3.0
✔ Finishing install process
✔ Configuring Ghost
✔ Setting up instance
ℹ Ensuring user is not logged in as ghost user [skipped]
ℹ Checking if logged in user is directory owner [skipped]
✔ Checking current folder permissions
✔ Validating config
✔ Checking memory availability
✔ Starting Ghost
Ghost uses direct mail by default. To set up an alternative email method read our docs at https://ghost.org/mail
------------------------------------------------------------------------------
Ghost was installed successfully! To complete setup of your publication, visit:
http://localhost:2368/ghost/
启动 ghost
安装成功后 Ghost 默认就已经启动的
停止host
[ghost@localhost ghost]$ ghost stop
✔ Stopping Ghost
启动ghost
[ghost@localhost ghost]$ ghost start
重启ghos
[ghost@localhost ghost]$ ghost restart
安装成功后默认是运行在http://localhost:2368/
访问:
curl http://localhost:2368/
Nginx和整合nodejs
vim ghost.conf
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:2368;
proxy_redirect default;
}
}
访问
前台页面
http://ip/
后台登录页面
http://ip/ghost