Total Pageviews

Wednesday, 7 May 2014

在linux vps上安装基于php5.4的静态博客程序-SPRESS

要求PHP >= 5.4,并安装composer.
(运行curl -sS https://getcomposer.org/installer | php即可装好composer)
git clone https://github.com/yosymfony/Spress spress
cd spress


as3:~/spress# ls
app  composer.json  LICENSE           README.md  tests
bin  composer.lock  phpunit.xml.dist  src        vendor
as3:~/spress# cd bin
as3:~/spress/bin# ls
spress
as3:~/spress/bin# ln -s ~/spress/bin/spress /usr/local/bin/spress
as3:~/spress/bin# cd ..
as3:~/spress# git clone https://github.com/yosymfony/Spress-example
as3:~/spress# cd Spress-example
as3:~/spress/Spress-example# ls
404.html       config.yml   index.html  README.md 
assets         favicon.ico  _layouts    rss.xml
composer.json  _includes    _posts      sitemap.xml
as3:~/spress/Spress-example# nano config.yml
把url的值由http://yosymfony.github.io/Spress-example/改为你自己的域名地址,我的为
http://as3.brite.biz:34270/,这个我等下还要改为我的域名地址-http://spress.surmount.biz.wf
as3:~/spress/Spress-example# cd ..
as3:~/spress# spress site:build -s Spress-example (这个就是生成/更新静态网站的命令)
as3:~/spress# cd Spress-example
as3:~/spress/Spress-example# ls
404.html       config.yml   index.html  README.md  sitemap.xml
assets         favicon.ico  _layouts    rss.xml
composer.json  _includes    _posts      _site
(新出现了_site目录)
as3:~/spress/Spress-example# cd _site
as3:~/spress/Spress-example/_site# ls
404.html  assets  example  favicon.ico  index.html  page2  rss.xml  sitemap.xml
(可见~/spress/Spress-example/_site/就是静态网站的根目录)
as3:~/spress/Spress-example/_site#  nohup Rwebserver 34270 > /dev/null &
访问http://as3.brite.biz:34270即可看到网站效果。

发帖方法:
as3:~/spress/Spress-example/_site# cd ../_posts
as3:~/spress/Spress-example/_posts# nano 2014-05-07-test1.md
格式如下:
---
layout: post
categories: [example]
tags: [misc1, misc2]
date: 2014-05-07 16:10 (此行一定要加上,否则发表的帖子不是按时间顺序排列的)
---

<h2>测试1</h2>
这是测试1.

然后,
as3:~/spress/Spress-example/_posts# cd ~/spress
as3:~/spress# spress site:build -s Spress-example

demo site: http://as3.brite.biz:34270,http://spress.surmount.biz.wf
项目地址:https://github.com/yosymfony/Spress
https://github.com/yosymfony/Spress-example

哈,以前写过的-http://briteming.blogspot.co.uk/2014/01/linux-vpsphp-spress.html,
我都不记得了