在这里分享一下我的博客的nginx.conf文件,因为nginx对pathinfo支持总是有那么一点问题。。参考了下70的写法,然后弄出了下面那些玩意儿。。表示工作十分正常(用的lnmp.org的lnmp一键安装包)
代码语言:javascript复制server{
listen 80;
server_name blog.izgq.net;
index index.php index.html;
root /home/wwwroot/blog;
location /
{
try_files $uri $uri/ /index.php?$args;
}
location ~ [^/].php(/|$) {
fastcgi_split_path_info ^(. .php)(/. )$;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi.conf;
}
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
{
#try_files $uri $uri/ /index.php$is_args$args;
expires 30d;
}
location ~ .*.(js|css)?$
{
expires 12h;
}
access_log off;
}
用它的时候你只需要把站点目录和域名换掉就行了 ^__^