一直以来,都使用xwiki做为团队内部的文档管理工具,但一直想换一个比较轻量级的系统。团队成员广泛对gitbook风格有好感,因而前后试用了mdwiki、dokuwiki、hexo、mindoc、wikitten。php
mdwiki:纯粹用AJAX写的,部署最简单,可是目录只能两级;css
dokuwiki:PHP写的,没有数据库,有很多插件。一直在这个和wikitten中犹豫,最后仍是选择了wikitten,主要仍是界面风格,wikitten比较简洁;html
hexo:采用node.js开发的,也是由于这个才知道wikitten。由于服务器上已经有PHP的环境了,不想再增长node.js,因此放弃了,不然是很好的选择;node
mindoc:golang开发的,这个其实也不错,但我只要一本书,他却提供了一个书柜;nginx
wikitten:PHP写的,没有数据库,没有插件,文档也少。但界面一眼看中了,就这样了。git
到github下载,解压。网上说PHP须要fileinfo组件,其实还须要json组件,这个须要注意了。因为我使用nginx,而且无法安装到站点根目录下,因此一直有问题。github
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就好,因此也就懒得折腾了,用这种方式来作吧。golang
补记:数据库
通过调试比对apache下的配置,发现问题出在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', '');