Skip to main content

self
Table of Contents

记录搭建 Ghost 博客。基于 Node.js 再配合 Nginx 代理。资料库可选 SQLite 或者 MySQL。后台使用实时运行的 Markdown 编辑器。

❗ 文章可能不适用于最新版本,详细安装、运行方法, 看官网文档

系统要求
#

安装 Node.js 很简单,到官方网站点击那个很大的 Install 按钮。

下载
#

安装
#

解压后,打开 Ghost 目录,例如:~/ghost

执行命令 npm install --production

配置
#

编辑 ghost 文件夹的 config.js

修改 production 的 url

	production: {
    	url: "你的网址, 例如: http://blog.example.com",
        mail :{},
    }

你也可以改改端口。

运行
#

  1. 在 Ghost 目录运行:npm start
  2. 或者使用 Forever ( https://npmjs.org/package/forever) 后台运行 Ghost

安装 Forever:npm install forever -g

使用 Forever 运行 Ghost:NODE_ENV=production forever start index.js

使用 Forever 停止 Ghost 运行:forever stop index.js

查看在 Forever 运行中的程序:forever list

重新运行 Ghost。在 Ghost 的目录,执行:forever restart index.js

其他调配方法请查看 官方文件

Nginx 配置
#

https://gist.github.com/pnommensen/707b5519766ba45366dd

管理后台
#

打开 http://你的网址/ghost/,第一次回选择 Sign up,填一些基本资料。以后访问就可以用 email 登陆了。

其他安装方法:Docker
#

最简单的安装就是 docker 啦, docker hub 链接。无须安装 forever 或者 PM2,也无须创建 ghost 用户。