类似gitbook的wiki选择

简介:

一直以来,都使用xwiki作为团队内部的文档管理工具,但一直想换一个比较轻量级的系统。团队成员普遍对gitbook风格有好感,于是先后试用了mdwiki、dokuwiki、hexo、mindoc、wikitten。

mdwiki:纯粹用AJAX写的,部署最简单,但是目录只能两级;

dokuwiki:PHP写的,没有数据库,有不少插件。一直在这个和wikitten中犹豫,最后还是选择了wikitten,主要还是界面风格,wikitten比较简洁;

hexo:采用node.js开发的,也是因为这个才知道wikitten。因为服务器上已经有PHP的环境了,不想再增加node.js,所以放弃了,否则是很好的选择;

mindoc:golang开发的,这个其实也不错,但我只要一本书,他却提供了一个书柜;

wikitten:PHP写的,没有数据库,没有插件,文档也少。但界面一眼看中了,就这样了。

到github下载,解压。网上说PHP需要fileinfo组件,其实还需要json组件,这个需要注意了。由于我使用nginx,并且没法安装到站点根目录下,所以一直有问题。

location ~* ^/static/(css|js|img|fonts)/.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt|swf|pdf|txt|bmp|eot|svg|ttf|woff|woff2)$ {
    access_log off;
    expires max;
}
location /wiki/ {
    rewrite ^(.*)$ /wiki/index.php last;
}

主要是location /wiki/ 这段,如果没有,页面解析正常,但左侧tree的链接不正常,因为伪静态的原因,可以理解。但如果加上这一段,则页面解析不正常了,主要是static这个目录访问不到了。对PHP不怎么熟悉,并且还可以用php -S 0.0.0.0:8000 route.php执行,在nginx里配置一个proxy_pass就好,所以也就懒得折腾了,用这种方式来做吧。

补记:

经过调试比对apache下的配置,发现问题出在apache有这么一句:

RewriteCond %{THE_REQUEST} !^GET\ /.*?static/(css|js|img)

经过在https://segmentfault.com/q/1010000014633581讨教,终于知道了原因:

!^GET\ /.*?static/(css|js|img)表示排除/static/(css|js|img)这些路径的请求
nginx没有对应的排除的方法
可以用变通的方法
先给location /一个try_files,然后优先匹配/static/(css|js|img),匹配到的不配置try_files

location / {
    try_files $uri $uri/ /index.php;
}

location ~* ^/.*static/(css|js|img)/ {
    expires 1d;
}

参考以上的内容修改

 location / {
            root   /usr/local/www/nginx;
            index  index.html index.htm index.php;
            # Wikitten
            try_files $uri $uri/ /wiki/index.php;
        }


location ~* ^/static/(css|js|img|fonts)/.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt|swf|pdf|txt|bmp|eot|svg|ttf|woff|woff2)$ {
    access_log off;
    expires max;
}

完美的解决了问题。

其它注意要点:

如果APP_NAME要用中文,那么config.php一定要转成UTF8保存,否则没法正常显示。

<?php
// Example configuration file for Wikitten. To use it,
// first rename it to `config.php`.

// Custom name for your wiki:
define('APP_NAME', '这里用中文');

// Set the filename of the automatic homepage here
define('DEFAULT_FILE', 'index.md');

// Custom path to your wiki's library:
// define('LIBRARY', '/path/to/wiki/library');

// Enable editing files through the interface?
// NOTE: There's currently no authentication built into Wikitten, controlling
// who does what is your responsibility.
// define('ENABLE_EDITING', true);

// Enable JSON page data?
// define('USE_PAGE_METADATA', true);

// Enable the dark theme here
// define('USE_DARK_THEME', true);

// Disable the Wikitten logo here
define('USE_WIKITTEN_LOGO', false);

// Enable PasteBin plugin ?
// define('ENABLE_PASTEBIN', true);
// define('PASTEBIN_API_KEY', '');

 

目录
相关文章
|
6月前
[教程]使用gitbook写书
[教程]使用gitbook写书
|
开发工具 git
gitbook docs 序言
gitbook docs 序言
|
前端开发
gitbook 插件:视频
gitbook 插件:视频
gitbook 插件:视频
Hexo、Jekyll、Sphinx、mkdocs、docsify等静态博文档汇总
Hexo、Jekyll、Sphinx、mkdocs、docsify等静态博文档汇总
175 0
Hexo、Jekyll、Sphinx、mkdocs、docsify等静态博文档汇总
类似GitBook的文档构建工具
类似GitBook的文档构建工具
1460 0
类似GitBook的文档构建工具