多语言展示
当前在线:1276今日阅读:75今日分享:44

如何在树莓派上搭建一个博客

看到博客志分享的一个方法
工具/原料
1

树莓派 x1

2

公网 IP x1

方法/步骤
1

安装 Node 运行环境// 原地址 http://node-arm.herokuapp.com/,为方便国内用户下载建立了镜像wget http://l.eqoe.cn/6pnrdpkg -i *.deb

2

加速 NPM 下载速度使用下面的命令安装淘宝 NPM 镜像npm install -g cnpm --registry=https://registry.npm.taobao.org

3

安装 Ghost有人说我为何不用自己的博客系统?首先树莓派的内存很小,不适合运行数据库,而 Ghost 支持 Sqlite ,可以很好的在低端设备运行,其次我也想试一下 Ghost 。不知道tyecho能不能用, 貌似博客志daquan8.com 也是用这个方法?git clone https://github.com/TryGhost/Ghost.gitcd Ghost cnpm install --production

4

配置cp config.example.js config.jsvi config.js

5

修改 url 为网站地址

6

设置 Supervisor 以持久运行apt-get install supervisorvi /etc/supervisor/conf.d/ghost.js填入以下内容[program:ghost]directory = /path/to/ghostcommand = npm start --productionautostart=trueautorestart=true重启 supervisordservice supervisor restart

7

公网访问在路由器设置端口转发将域名解析到你的 IP,可以使用动态 DNS

8

Additional Options增加 CDN使用 CDN 缓存页面可以加快访问速度,减轻树莓派的压力。免费的 CDN 有很多,这里就不列举了。

推荐信息