Total Pageviews

Thursday, 12 June 2014

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

git clone https://github.com/samrat/ecstatic ecstatic-site
cd ecstatic-site

as3:~/ecstatic-site# ls
doc  project.clj  README.md  resources  src  test
as3:~/ecstatic-site# lein run
as3:~/ecstatic-site# ls
doc  project.clj  README.md  resources  src target test
as3:~/ecstatic-site# lein run --new mysite (此命令会在当前目录下,生成mysite目录)
as3:~/ecstatic-site# ls
doc  mysite  project.clj  README.md  resources  src  target  test
(新出现了mysite目录)
as3:~/ecstatic-site# cd mysite/src
as3:~/ecstatic-site/mysite/src# ls
code  config.clj  pages  posts  resources  snippets  templates
as3:~/ecstatic-site/mysite/src# nano config.clj
(把site-name的值改为你的站点名称)
as3:~/ecstatic-site/mysite/src# cd ..
as3:~/ecstatic-site/mysite# ls
src
as3:~/ecstatic-site/mysite# wget https://googledrive.com/host/0B1CmeJlGMtoLZGFYU3RRY1hldnc/ecstatic
as3:~/ecstatic-site/mysite# ls
ecstatic src
as3:~/ecstatic-site/mysite# chmod 755 ecstatic
as3:~/ecstatic-site/mysite# ./ecstatic --src src --output export (此命令会在当前目录下生成export目录.这个命令就是生成/更新静态网站的命令)
as3:~/ecstatic-site/mysite# ls
ecstatic  export  src
as3:~/ecstatic-site/mysite# cd export
as3:~/ecstatic-site/mysite/export# ls
archives  blog  feeds  index.html  resources  tags
(可见~/ecstatic-site/mysite/export/就是静态网站的根目录)
as3:~/ecstatic-site/mysite/export# nohup Rwebserver 43082 > /dev/null &
访问http://as3.brite.biz:43082/即可看到网站效果。

发贴方法:
as3:~/ecstatic-site/mysite/export# cd ../src/posts/
as3:~/ecstatic-site/mysite/src/posts# ls
2014-01-01-foo-bar.md  2014-01-27-lorem-markdownum.md
as3:~/ecstatic-site/mysite/src/posts# nano 2014-06-12-test1.md
按2014-01-01-foo-bar.md的格式,新建帖子2014-06-12-test1.md,格式如下:
---
title: test1
date: 2014-06-12T16:06:30Z
tags: misc1, misc2
---

这是测试1.


然后,
as3:~/ecstatic-site/mysite/src/posts#
 cd ../..
as3:~/ecstatic-site/mysite# ./ecstatic --src src --output export
(这个命令就是生成/更新静态网站的命令)

还可以克隆程序作者的网站源码,拿来使用:
as3:~/ecstatic-site/mysite# git clone https://github.com/samrat/samrat.github.com samrat.github.com-site
as3:~/ecstatic-site/mysite# cd samrat.github.com-site
as3:~/ecstatic-site/mysite/samrat.github.com-site# ls
archives  ecstatic                     happychart.png  resources
blog      favicon.ico                  images          samrat-pubkey.asc
books     feeds                        index.html      src
CNAME     google1273dd2fbfcd9338.html  projects        tags
(可见 ~/ecstatic-site/mysite/samrat.github.com-site/就是静态网站的根目录)
as3:~/ecstatic-site/mysite/samrat.github.com-site# cd src
as3:~/ecstatic-site/mysite/samrat.github.com-site/src# ls
code        favicon.ico  posts      site.cache  templates
config.clj  pages        resources  snippets
as3:~/ecstatic-site/mysite/samrat.github.com-site/src# cd posts
as3:~/ecstatic-site/mysite/samrat.github.com-site/src/posts# nano 2014-06-12-test1.md
格式为:
---
title: test1
date: 2014-06-12T18:26:30Z
tags: misc1, misc2
---

这是测试1.

  
然后,

as3:~/ecstatic-site/mysite/samrat.github.com-site/src/posts# cd ..
as3:~/ecstatic-site/mysite/samrat.github.com-site/src# ~/ecstatic-site/mysite/ecstatic --src . --output ~/ecstatic-site/mysite/samrat.github.com-site/ (这个就是生成/更新静态网站的命令)
as3:~/ecstatic-site/mysite/samrat.github.com-site/src# cd ..
as3:~/ecstatic-site/mysite/samrat.github.com-site# nohup Rwebserver 39846 > /dev/null &
访问http://as3.brite.biz:39846/即可看到网站效果。


演示站点:http://as3.brite.biz:43082/,http://es.brite.biz.st;
http://as3.brite.biz:39846/,http://es2.brite.biz.st
项目地址:https://github.com/samrat/ecstatic,
https://github.com/samrat/samrat.github.com
http://samrat.me/ecstatic/