Total Pageviews

Monday, 13 January 2014

在linux vps上编译plan9,然后搭建静态博客程序-werc

mkdir /usr/local/plan9
cd /usr/local/plan9
wget http://plan9port.googlecode.com/files/plan9port-20140107.tgz
tar zxvf plan9port-20140107.tgz
mv plan9port/* .
rm -rf plan9port

as3:/usr/local/plan9# ls
plan9port  plan9port-20140107.tgz
as3:/usr/local/plan9# ls plan9port
acid          dict     INSTALL      lp        ndb         rcmain  TODO
bin           dist     install.txt  mac       news        README  troff
CHANGES       face     lib          mail      plumb       sky     unix
configure     font     LICENSE      Makefile  postscript  src
CONTRIBUTORS  include  log          man       proto       tmac
as3:/usr/local/plan9# mv plan9port/* .
as3:/usr/local/plan9# ls plan9port
as3:/usr/local/plan9# rm -rf plan9port
as3:/usr/local/plan9# ls
acid          dist         lib      Makefile                postscript  tmac
bin           face         LICENSE  man                     proto       TODO
CHANGES       font         log      ndb                     rcmain      troff
configure     include      lp       news                    README      unix
CONTRIBUTORS  INSTALL      mac      plan9port-20140107.tgz  sky
dict          install.txt  mail     plumb                   src
as3:/usr/local/plan9# ./INSTALL (这一步需耗时10分钟)
(参考http://swtch.com/plan9port/man/man1/install.html)
最后提示:
Add these to your profile environment.
        PLAN9=/usr/local/plan9 export PLAN9
        PATH=$PATH:$PLAN9/bin export PATH
(编辑/etc/profile,加入:
PLAN9=/usr/local/plan9 export PLAN9
PATH=$PATH:$PLAN9/bin export PATH  )
然后运行:
. /etc/profile
或者:
source /etc/profile

as3:/usr/local/plan9# cd ~
root@as3:~# git clone https://github.com/Knorkebrot/werc
root@as3:~# cd werc
as3:~/werc# ls
apps  bin  etc  lib  pub  README  sites  tpl
as3:~/werc# cd sites
as3:~/werc/sites# ls
my-site-rootdir  tst.cat-v.org  werc.cat-v.org
as3:~/werc/sites#

先去编辑apache2的配置文件,加入如下的virtualhost段:
<VirtualHost my-vps-ip:80>
    RewriteEngine On
    ServerName werc.brite.biz
    AddHandler cgi-script .rc
    AddHandler cgi-script .cgi
    <Directory /root/werc/bin>
        Options ExecCGI
    </Directory>
    <IfModule mod_dir.c>
        DirectoryIndex /werc.rc
    </IfModule>

    RewriteRule (.*) /root/werc/sites/%{HTTP_HOST}/$1

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* /root/werc/bin/werc.rc

    RewriteRule /werc.rc /root/werc/bin/werc.rc
    DocumentRoot /root/werc/bin/
</VirtualHost>
重启apache2。


as3:~/werc/sites# mkdir werc.brite.biz
as3:~/werc/sites# ls
my-site-rootdir  tst.cat-v.org  werc.brite.biz  werc.cat-v.org
as3:~/werc/sites# cp -r werc.cat-v.org/* werc.brite.biz/
as3:~/werc/sites# ls werc.cat-v.org/
apps  development  docs  index.md  testimonials.md  _werc  wiki
as3:~/werc/sites# ls werc.brite.biz
apps  development  docs  index.md  testimonials.md  _werc  wiki
as3:~/werc/sites#

发贴方法:
as3:~/werc/sites# cd werc.brite.biz
as3:~/werc/sites/werc.brite.biz# ls
apps  development  docs  index.md  testimonials.md  _werc  wiki
as3:~/werc/sites/werc.brite.biz# cd docs
as3:~/werc/sites/werc.brite.biz/docs# ls
config-options.md  rc-template-lang.md    user-management.md
css-style.md       site-customization.md  web-server-setup
dir-listings.md    _werc
as3:~/werc/sites/werc.brite.biz/docs# nano test1.md
按~/werc/sites/werc.brite.biz/docs/里的css-style.md的内容格式,新建帖子test1.md,格式如下:
test1
=====

这是测试1.

保存更改,然后网站就自动更新了。
as3:~/werc/sites/werc.brite.biz/docs# cd ..
as3:~/werc/sites/werc.brite.biz# nano index.md
在index.md文件的最上面一行加上:
<a href=/docs/>我的帖子在此</a>

演示站点:
http://werc.brite.biz/,http://werc.brite.biz/docs/,http://werc.brite.biz/docs/test1
http://werc.brite.biz/docs/test2,http://werc.brite.biz/docs/fengyuwuzu,
http://werc.brite.biz/docs/chinese-economy
项目地址:
http://werc.cat-v.org/
https://github.com/Knorkebrot/werc