Total Pageviews

Thursday 30 January 2014

在linux vps上搭建基于nodejs的静态博客程序-nodeache

git clone https://github.com/nunull/nodeache
cd nodeache

as3:~/nodeache# ls
example  nodeache.js    README.md
LICENSE  package.json
as3:~/nodeache# npm install
as3:~/nodeache# ls
example  LICENSE  nodeache.js  node_modules  package.json  README.md
as3:~/nodeache# cd example/
as3:~/nodeache/example# ls
config.json  content  output  templates
as3:~/nodeache/example# cd output
as3:~/nodeache/example/output# ls
css  index.html
as3:~/nodeache/example/output#
可见~/nodeache/example/output/就是静态网站的根目录。
as3:~/nodeache/example/output# nohup Rwebserver 34290 > /dev/null &
访问http://as3.brite.biz:34290/,就可看到网站效果。

发贴方法:
as3:~/nodeache/example/output# cd ..
as3:~/nodeache/example# ls
config.json  content  output  templates
as3:~/nodeache/example# cd content
as3:~/nodeache/example/content# ls
articles  global.json
as3:~/nodeache/example/content# cd articles
as3:~/nodeache/example/content/articles# ls
01-Test.md 
as3:~/nodeache/example/content/articles# nano test2.md
按01-Test.md的格式,新建帖子test2.md,
格式为:
##  测试2

这是测试2.
as3:~/nodeache/example/content/articles# nano test3.md
内容为:
这是测试3.
as3:~/nodeache/example/content/articles# cd ~/nodeache/
as3:~/nodeache# node nodeache.js example
会显示:
nodeache   v0.6.4
[14:08:52] Parsing 'example'... done.
(node nodeache.js example就是更新静态网站的命令)

演示站点:http://as3.brite.biz:34290/,http://na.brite.biz.st
项目地址:https://github.com/nunull/nodeache