Total Pageviews

Thursday 22 May 2014

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

curl http://getcomposer.org/installer | php (此命令会下载composer.phar到当前目录下)
显示:
...
Downloading...
Composer successfully installed to: /root/composer.phar
Use it: php composer.phar

mv composer.phar /usr/local/bin/

git clone https://github.com/miguelibero/meinhof
cd meinhof
composer.phar install

git clone https://github.com/miguelibero/meinhof-standard
cd meinhof-standard
composer.phar install
(会出现一些提示问题,回答它们),会显示:
...
looks like your site needs to be set up first...
  Welcome to the Meinhof site setup
This will generate a basic site configuration structure for you.
Please answer some basic questions for the setup.
Author name [Joe Schmoe <joe@schmoe.com>]: ym
Site name [Meinhof site]: ym's Meinhof site
Updating your site setup...
.
.
..
as3:~/meinhof/meinhof-standard# ls
bin            composer.lock  posts   README.md  views
composer.json  config         public  vendor     web
as3:~/meinhof/meinhof-standard# ls web
categories  css  index.html  js  post
as3:~/meinhof/meinhof-standard# cd web
as3:~/meinhof/meinhof-standard/web# ls
categories  css  index.html  js  post
(可见~/meinhof/meinhof-standard/web/就是静态网站的根目录)
as3:~/meinhof/meinhof-standard/web# nohup Rwebserver 32194 > /dev/null &
访问http://as3.brite.biz:32194/即可看到网站效果。

发贴方法:
as3:~/meinhof/meinhof-standard/web# cd ..
as3:~/meinhof/meinhof-standard# ls
bin            composer.lock  posts   README.md  views
composer.json  config         public  vendor     web
as3:~/meinhof/meinhof-standard# cd posts
as3:~/meinhof/meinhof-standard/posts# ls
learn-meinhof.markdown
as3:~/meinhof/meinhof-standard/posts# nano test1.markdown
格式为:
---
title: test1
updated: 22/05/2014
publish: true
categories:
    - misc
---

这是测试1.

然后,
as3:~/meinhof/meinhof-standard/posts# cd ..
as3:~/meinhof/meinhof-standard# ls
bin            composer.lock  posts   README.md  views
composer.json  config         public  vendor     web
as3:~/meinhof/meinhof-standard# composer.phar install  (这个就是重新生成/更新静态网站的命令)
你可能会遇到出错提示:
[Exception]
  DateTime::__construct(): It is not safe to rely on the system's timezone se
  ttings. You are *required* to use the date.timezone setting or the date_def
  ault_timezone_set() function. In case you used any of those methods and you
   are still getting this warning, you most likely misspelled the timezone id
  entifier. We selected the timezone 'UTC' for now, but please set date.timez
  one to select your timezone.
解决办法:
as3:~/meinhof/meinhof-standard# nano /etc/php5/apache2/php.ini
找到此行 ;date.timezone = ,去掉;号,date.timezone的值设为Europe/London (我的vps在英国),即改为:
date.timezone = Europe/London
然后重启apache2.
as3:~/meinhof/meinhof-standard#

演示站点:http://as3.brite.biz:32194/,http://mh.surmount.biz.wf
项目地址:https://github.com/miguelibero/meinhof
https://github.com/miguelibero/meinhof-standard

在这个程序下,同一天所发表的帖子并非按时间顺序排列。部分静态博客程序有这问题。