树莓派日记——搭建Ghost博客并内网转发

大家都知道树莓派派的性能很有限,所以如果想要在树莓派上搭建博客肯定要选择轻量级的,Ghost是个不错的选择,GhostNode.js开发,支持sqlite,内网转发方面选择糖果科技的ngrok

1.安装Node.js

现在Ghost推荐推荐安装 4.x(LTS)版本的 Node.js

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -  
sudo apt-get install -y nodejs 

可输入以下命令查看版本并检查是否安装成功

node -v

若显示版本为4.x则安装成功

2.安装Ghost

不要选择完整版,因为完整版里的有些node_modules没有支持arm架构的

wget http://dl.ghostchina.com/Ghost-0.7.4-zh.zip

解压zip并进入到该文件夹执行以下命令

npm install -production

这里需要点耐心,因为有些包没有arm架构的,需要通过源码编译

3.运行Ghost

先拷贝一份配置文件并改名

cp config.example.js config.js

启动Ghost

npm start

等初始化完那些表之后访问http://localhost:2368查看效果

4.创建管理员用户

访问http://localhost:2368/ghost/按照指引即可创建管理员

5.内网转发

下载Linux ARM的客户端

解压后在命令行下进入到解压目录下输入

./ngrok -config=ngrok.cfg -subdomain 自定义的域名 端口号

若显示

ngrok                                                           (Ctrl+C to quit)
                                                                                
Tunnel Status                 online                                            
Version                       1.7/1.7                                           
Forwarding                    http://隧道名.tunnel.qydev.com -> 127.0.0.1:2368
Forwarding                    https://隧道名.tunnel.qydev.com -> 127.0.0.1:236
Web Interface                 127.0.0.1:4040                                    
# Conn                        39                                                
Avg Conn Time                 95860.04ms       

则证明配置成功,可访问通过外网访问http://隧道名.tunnel.qydev.com

6.配置Ghsot的url

若想要通过外网去访问Ghost的后台则需配置url
打开之前拷贝好的config.js
将development(不是production)下的配置url改为新分配的url,如:

// ### Development **(default)**
    development: {
        // The url to use when providing links to the site, E.g. in RSS and email.
        // Change this to your Ghost blog's published URL.
        url: 'http://jkgeekjk.tunnel.qydev.com:2368',

我用树莓派搭建的Ghost博客,欢迎访问http://jkgeekjk.tunnel.qydev.com/

你可能感兴趣的:(树莓派日记——搭建Ghost博客并内网转发)