用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2370|回复: 0
收起左侧

[HELP] nginx 不支持ci的 研究

[复制链接]
发表于 2012-2-29 11:49:47 | 显示全部楼层 |阅读模式
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
   sendfile        on;
   keepalive_timeout  65;
   server {
       root /usr/local/webserver/nginx/html;
       listen       80;
       server_name  localhost;
       error_page   500 502 503 504  /50x.html;
        location /{
                       root   html;
                      index  index.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_index  index.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

本版积分规则