server
{
listen 80;
charset utf-8;
server_name www.test.com; #绑定域名,空格分割可指向多个域名,或者泛域名*.test.com

root /www/test; #网站根目录
location / { 
        index  index.html index.htm;

        if (-d $request_filename){
            rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
        }   

        if (-f $request_filename/index.php){
            rewrite ^.*$ $document_uri/index.php last;
        }   

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

location ~ \.php($|/) {
        fastcgi_pass   127.0.0.1:9001;
        fastcgi_index  index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_param   PATH_INFO $fastcgi_path_info;
       # fastcgi_param  SCRIPT_FILENAME $document_root/$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
        }
}