黑豆 发表于 2012-2-29 11:49:47

nginx 不支持ci的 研究

worker_processes1;
events {
    worker_connections1024;
}
http {
    include       mime.types;
    default_typeapplication/octet-stream;
   sendfile      on;
   keepalive_timeout65;
   server {
       root /usr/local/webserver/nginx/html;
       listen       80;
       server_namelocalhost;
       error_page   500 502 503 504/50x.html;
      location /{
                     root   html;
                      indexindex.php index.html index.htm;
                      if (-f $request_filename) {
                      expires max;
                      break;
                                                   }

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

      location = /50x.html {
                  root   /usr/local/webserver/nginx/html;
                                 }

location ~ \.php {
         root         html;
         fastcgi_pass   127.0.0.1:9000;
         fastcgi_indexindex.php;
      
set $path_info "";
    set $real_script_name $fastcgi_script_name;
    if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
    set $real_script_name $1;
    set $path_info $2;
    }
    fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
    fastcgi_param SCRIPT_NAME $real_script_name;
    fastcgi_param PATH_INFO $path_info;

    include      fastcgi_params;

      }


         }
}
上面是 具体配置
经过分析 发现是 ci url.php 的一个 $_SERVER['SCRIPT_NAME']问题 http://www.swsdd.com/index.php/welcome/test正常的 是$_SERVER['SCRIPT_NAME']=/index.php但是 用 nginx的这个配置 $_SERVER['SCRIPT_NAME']=/index.php/welcome/test   这个显然不对 请问如何改 nginx配置文件 让 $_SERVER['SCRIPT_NAME']=/index.php
页: [1]
查看完整版本: nginx 不支持ci的 研究