tp3.2 nginx構成アクセスパスの問題

1796 ワード

server {
        listen 80;
        server_name www.test.com;
        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
       #   \.php        ,             location     
        location ~ \.php {
                root "D:/";
                fastcgi_pass 127.0.0.1:9000;
                #  nginx      fastcgi     ,php   $_SERVER['   ']   
                include   fastcgi.conf;
                #    $fastcgi_script_name_new   $fastcgi_script_name  
                set $path_info "";
                set $fastcgi_script_name_new $fastcgi_script_name;
                #  url   pathinfo   ,       url      ,index.php       pathinfo    $path_info   ,      $document_root     index.php                .
              if ($fastcgi_script_name ~*   "^(.+\.php)(/.+)$"  ) {
                        set $fastcgi_script_name_new $1;
                        set $path_info $2;
                }
                   
                        # fastcgi.conf  SCRIPT_FILENAME SCRIPT_NAME fastcgi      ,                     script_filename  , fastcgi  index.php    。
                        fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name_new;
                        fastcgi_param   SCRIPT_NAME   $fastcgi_script_name_new;
                        #      nginx      fastcgi   PATH_INFO,thinkphp        index.php  pathinfo  
                        fastcgi_param   PATH_INFO $path_info;
        }
#         ,           ,         location ,    location            
      location / {
                root "D:/";
                index index.php index.html index.htm;
                if (!-e  $request_filename){
                        rewrite ^(.*)$ /index.php$1 last;
                }
        }
}