Total Pageviews

Friday, 6 June 2014

在linux vps上搭建基于unix命令的静态博客程序-simsalabash

git clone https://github.com/markusfisch/simsalabash simsalabash-site
cd simsalabash-site

as3:~/simsalabash-site# ls
examples  modules  README.md  simsalabash
as3:~/simsalabash-site# cd examples
as3:~/simsalabash-site/examples# ls
blog-complex  blog-simple  simple
as3:~/simsalabash-site/examples# cd blog-complex
as3:~/simsalabash-site/examples/blog-complex# ls
contents  htdocs  layouts  lib  Makefile
as3:~/simsalabash-site/examples/blog-complex# cd contents/posts
as3:~/simsalabash-site/examples/blog-complex/contents/posts#
as3:~/simsalabash-site/examples/blog-complex/contents/posts# ls
one  two
as3:~/simsalabash-site/examples/blog-complex/contents/posts# cd one
as3:~/simsalabash-site/examples/blog-complex/contents/posts/one# nano 2014-06-06-test-one
按当前目录下的某个文件,比如2011-04-01-Vestibulum-ante的格式,新建帖子2014-06-06-test-one,格式为:
<h1>测试1</h1>

这是测试1.


(注意:源贴文件名中不可带数字,比如不能写成2014-06-06-test1或2014-06-06-test-1,这是一个bug)

然后,
as3:~/simsalabash-site/examples/blog-complex/contents/posts/one# cd ~/simsalabash-site/examples/blog-complex/
as3:~/simsalabash-site/examples/blog-complex# make (这就是更新静态网站的命令,其实就是运行../../simsalabash)
../../simsalabash
as3:~/simsalabash-site/examples/blog-complex#
as3:~/simsalabash-site/examples/blog-complex# cd htdocs
as3:~/simsalabash-site/examples/blog-complex/htdocs# ls
about.html
blog.html
css
index.html
posts-one-2011-01-01-lorem-ipsum.html
posts-one-2011-02-01-donec-pede-justo.html
posts-one-2011-03-01-nam-eget-dui.html
posts-one-2011-04-01-vestibulum-ante.html
posts-two-2011-01-01-lorem-ipsum.html
posts-two-2011-02-01-donec-pede-justo.html
posts-two-2011-03-01-nam-eget-dui.html
posts-one-2014-06-06-test-one.html
(可见~/simsalabash-site/examples/blog-complex/htdocs/就是静态网站的根目录)
as3:~/simsalabash-site/examples/blog-complex/htdocs# nohup Rwebserver 43204 > /dev/null &
访问http://as3.brite.biz:43204/index.html,http://as3.brite.biz:43204/blog.html即可看到网站效果。

另外,
as3:~/simsalabash-site/examples/blog-complex/htdocs# cd ~/simsalabash-site/examples/
as3:~/simsalabash-site/examples# ls
blog-complex  blog-simple  simple
as3:~/simsalabash-site/examples# cd blog-simple
as3:~/simsalabash-site/examples/blog-simple# ls
contents  htdocs  layouts  lib  Makefile
as3:~/simsalabash-site/examples/blog-simple# cd htdocs
as3:~/simsalabash-site/examples/blog-simple/htdocs# ls
about.html  posts-2011-01-01-lorem-ipsum.html
blog.html   posts-2011-02-01-donec-pede-justo.html
css         posts-2011-03-01-nam-eget-dui.html
index.html  posts-2011-04-01-vestibulum-ante.html
(这是一个简版。这里~/simsalabash-site/examples/blog-simple/htdocs/就是简版的静态网站的根目录)
as3:~/simsalabash-site/examples/blog-simple/htdocs# nohup Rwebserver 43205 > /dev/null &
访问http://as3.brite.biz:43205/index.html即可看到网站效果。发贴方法跟complex版是一样的。可以看到complex版的~/simsalabash-site/examples/blog-complex/contents/posts的里面有one,two之分;而简版的~/simsalabash-site/examples/blog-simple/contents/posts的里面没有one,two之分。这样,complex版就可以通过one目录,two目录起到分类的作用。如果你想建立新的分类比如three,就可在~/simsalabash-site/examples/blog-complex/contents/posts的里面新建目录three.

演示站点:http://as3.brite.biz:43204/blog.html,http://sslb.brite.biz.st,
http://sslb.brite.biz.st/blog.html
(http://as3.brite.biz:43205/index.html,http://as3.brite.biz:43205/blog.html)
项目地址:https://github.com/markusfisch/simsalabash
https://github.com/markusfisch/simsalabash/issues/1 (此处谈了如何纠正帖子的顺序问题)