Total Pageviews

Friday, 3 January 2014

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

wget https://github.com/janpecha/WebGen/archive/master.zip
mv master.zip WebGen-master.zip
unzip WebGen-master.zip
mv WebGen-master WebGen
cd WebGen

as3:~/WebGen# ls
bin  example  libs  license.txt  readme.md  webgen.phpc
as3:~/WebGen# cd example
as3:~/WebGen/example# php -f ~/WebGen/webgen.phpc -- --run --onedir
(这个就是生成/更新静态网站的命令)
as3:~/WebGen/example# ls
config.neon  input  lastBuild.dat  @layout.latte  output
(新出现了output目录)
as3:~/WebGen/example# cd output
as3:~/WebGen/example/output# ls
articles  index.html
(可见~/WebGen/example/output/就是静态网站的根目录)
as3:~/WebGen/example/output# nohup python -m SimpleHTTPServer 23288 > /dev/null &
访问http://as3.brite.biz:23288/,就可看到网站效果。

发贴方法:
as3:~/WebGen/example/output# cd ~/WebGen/example/input/articles/
as3:~/WebGen/example/input/articles# ls
article-1.latte  article-2.texy
as3:~/WebGen/example/input/articles#
按article-2.texy的格式,新建帖子test-chinese.texy,格式如下:
看看如何
#######

测试一下中文。


然后:
as3:~/WebGen/example/input/articles# cd ~/WebGen/example
as3:~/WebGen/example# php -f ~/WebGen/webgen.phpc -- --run --onedir

遗憾的是所发表的文章并未自动显示在首页。只好到http://wg.brite.biz/articles/去查看了。
update:知道怎么做了-编辑“源目录"-~/WebGen/example/input/中的index.texy文件,
nano ~/WebGen/example/input/index.texy
(在此行* "Article #2":articles/article-2.html的下一行添加:
* "Article #3":articles/article-3.html
* "Article #4":articles/article-4.html
* "中国经济":articles/chinese-economy.html
* "风雨无阻":articles/fengyuwuzu.html
* "看看如何":articles/test-chinese.html

然后,
cd ~/WebGen/example/
php -f ~/WebGen/webgen.phpc -- --run --onedir )

demo site: http://as3.brite.biz:23288/,HTTP://WG.BRITE.BIZ
项目地址:https://github.com/janpecha/WebGen

此程序跟dwarf( http://briteming.blogspot.co.uk/2013/12/linux-vpsphp-dwarf.html)和
deco (http://briteming.blogspot.co.uk/2014/01/linux-vpsphp-deco.html)有些类似,都需要编辑“源目录"中的index文件来让已发表的文章显示在首页。
已发表的文章不会自动显示在首页。