msgbartop
用铅笔写日记,记录那最原始的美丽
msgbarbottom

11-7-31 Typecho 何时才能走出nginx的圈子?

话说我从Wordpress转到Typecho 已经有一段时间了,总体来说,感觉还行~ 唯一让我不爽的就是typecho 对其他web server 支持的很差,特别是在伪静态(mod_rewrite)方面。

我可以这样讲,现在我的博客后台就是废的,基本上连对游客评论的编辑、删除都不能做到。因为这些功能都基于web 服务器对地址的重写。

比如,我在后台要删除一个用户的评论(当然我很少,几乎没有那样做),我点击了“删除”按钮,其实我是对应的向“http://xxxxx.xxxx/index.php/action/comments-edit?do=delete&coid=####”这个地址发送了请求。按说应该是index.php 这个页面接受了这个请求,然后根据传来的参数对数据库里的某条记录做了“删除”的处理。

可是很杯具的是,这个页面根本不会接受到任何请求。因为typecho 可怜的兼容性。

大家可能知道,我的web 服务器用的hiawatha,它显然不在typecho 支持的web 服务器列表之中,应该说typecho 目前只支持nginx才对~

我按照typecho 官方的文档(http://docs.typecho.org/servers)里面给出的针对nginx的地址重写的配置,写了适用于hiawatha的,或者说是与nginx 下等效的配置。见下:

nginx 之伪静态:

if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}

location ~ .*\.php(\/.*)*$ {
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}

hiawatha 之伪静态:

UrlToolkit {
ToolkitID = te
# Match ^(.*)/index\.php/.*$ Rewrite $1/index.php?$2
Match ^/index\.php(.*)$ Rewrite /index.php?$1
# RequestURI isfile Return
RequestURI exists Return
}

要我说,这两个的效果应该是一样,可是很遗憾的是,居然不起作用~ 至于原因,我只能揣测了~

话说,我之前在Wordpress上使用的WP-imgcode 和 user-agent-displayer 两款插件,我已经移植过来了。一直没有用上~ 原因很简单,插件的“激活”按钮(http://xxxxx.xxxx/index.php/action/plugins-edit?activate=XXXXX)不起作用~

访客的留言

    1. user-agent-displayer和wp-useragent有啥区别?

      1. 功能差不多,可能就是在页面显示样式上有些区别。

    2. 所以他们1年没发布新版本就是为了一个全新的版本吧

    3. 可能小鑫还不了解typecho吧,因为typecho是模仿wp的,通常情况下for wp的rewrite都能用到typecho身上的.

      1. 不会吧~我感觉差别很大...

    4. rewrite ^(.*)$ /index.php$1 last;

      Match ^/index\.php(.*)$ Rewrite /index.php?$1
      效果完全不一样啊……应该是
      RequestURI exists Return
      Match ^(.*)$ Rewrite /index.php$1
      这样才对

      1. 多一个“index.php”,我感觉差别不大吧~谢谢你的提示,我试试看~

      2. 试了下,改成了

        UrlToolkit {
        ToolkitID = te
        RequestURI exists Return
        Match ^(.*)$ Rewrite /index.php?$1
        Match ^/index\.php/pub\.htm Redirect /pub
        }

        提示404错误。删掉"RequestURI exists Return",前台可以访问,后台404依然。

      3. 这是服务器日志:

        222.71.232.210|Sun 28 Aug 2011 21:46:15 +0800|404|576||GET /index.php/2011/07/31/the-typecho-blog-platform-does-not-support-the-url-rewrite-function-on-many-other-web-servers-but-the-nginx.htm HTTP/1.1|Host: xiazhengxin.name|User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8|Accept-Language: zh-cn,zh;q=0.5|Accept-Encoding: gzip, deflate|Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7|DNT: 1|Referer: http://xiazhengxin.name/index.php/2011/07/31/the-typecho-blog-platform-does-not-support-the-url-rewrite-function-on-many-other-web-servers-but-the-nginx.htm|Cache-Control: max-age=0|X-Forwarded-For: 222.71.232.210|X-Varnish: 1860611018
        222.71.232.210|Sun 28 Aug 2011 21:47:01 +0800|404|576||GET /index.php/action/comments-edit?do=waiting&coid=16223 HTTP/1.1|Host: xiazhengxin.name|User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8|Accept-Language: zh-cn,zh;q=0.5|Accept-Encoding: gzip, deflate|Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7|Referer: http://xiazhengxin.name/admin/manage-comments.php|DNT: 1|Cache-Control: max-age=0|X-Forwarded-For: 222.71.232.210|X-Varnish: 1860611019

    5. 至此,我要很高兴的宣布,typecho 在 hiawatha 上的伪静态问题,已经完全解决了~哈哈

      具体操作,请移步:
      我的linux学习站
      http://linux.xiazhengxin.name

    6. 本站正式开始启用 WP-imgcode 和 advance-UA-displayer 两款插件。

      用验证码抵制垃圾留言~

      1. Willin Kan写过一段叫“小墙”的代码,抵制垃圾邮件很灵的。

        1. 哦,有时间看看~

          刚刚修复了advance UA displayer 的关于“遨游浏览器”判断错误以及MSIE 图标显示失败的bug~

          坑爹~

写下你的评论 »

(若看不到,请刷新。)