Typecho 在 Hiawatha web server 上的伪静态写法 

现在很多的人从Wordpress 转到了Typecho,从Apache httpd 转到了 Nginx.不得不说,typecho + nginx 是一个比较流行的博客搭配~

可是,使用除nginx外的其他用户就成了缺少支持的群体了,就拿typecho 来讲,它的官方doc(http://docs.typecho.org/servers)里面就没有提到除nginx 外的其他web server,连apache 也是轻描淡写的带过了。

那么,lighttpd 肿么办?hiawatha 肿么办?cherokee 肿么办?

没办法,只能用户自己搞定。

我就是一名typecho + hiawatha 的用户,一直以来,我的伪静态就不太理想,前台还行,后台很坑爹,基本属于不能用。

这是typecho 给出的适用于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
RequestURI exists Return
Match ^.*$ Rewrite /index.php$1
}


一直想把这个问题修复,今天在逛hiawatha的在线手册(http://www.hiawatha-webserver.org/manpages)的时候,无意发现了EnablePathInfo 标签,见下:

EnablePathInfo = yes|no
Accepts URLs like /index.php/parameter if /index.php exists and the extension .php has been configured as a CGI program. '/parameter' will be placed in the environment variable PATH_INFO.
Default = no, example: EnablePathInfo = yes


我忽然明白了hiawatha 和 nginx 的不同之处~火速编辑我的hiawatha配置文件,改成如下:

VirtualHost {
Hostname = xiazhengxin.name,blog.xiazhengxin.name
WebsiteRoot = /home/http/blog_xiazhengxin_name
StartFile = index.php
UseFastCGI = PHP4TE
UseToolkit = te
ShowIndex = yes
FollowSymlinks = yes
EnablePathInfo = yes #加了这一行
# AccessList = allow 127.0.0.1,deny all
}


即启用PHP 的PathInfo功能。果然,重启hiawatha,伪静态完美了~
[ ] ( 3487 次浏览 ) 永久链接 ( 3 / 2680 )

<< <上一页 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 下一页> >>