nginx下使用框架codeigniter PATH_INFO

2011-04-14 阅读 31

需要在nginx下使用codeigniter,网上看了很多解决方案,都没有搞定。

最后,还是自己分析原理,才最终解决了问题。

再次证明 观察、分析、推理,三部曲无敌。

记录配置信息:

<pre class="brush:plain;">    server {
        listen       80;
        server_name  www.abc.com;
        root /usr/local/discuz/www;

        if (-d $request_filename)
        {
  
        }

        index  index.php index.html index.htm;

        charset utf-8;

        access_log      logs/houtai.access.log;
        error_log       logs/houtai.error.log;

        location / {
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location ~ \.php($|/) {
  fastcgi_index index.php;

                include /usr/local/fastweb/nginx/conf/fcgi.conf;

  set $script "\index.php";
  set $path_info "";

  if ($uri ~ "^(.+?\.php)(/.*)$") {
   set $script $1;
   set $path_info $2;
  }
  fastcgi_param SCRIPT_NAME $script;
  fastcgi_param PATH_INFO $path_info;
  fastcgi_param  SCRIPT_FILENAME    $document_root$script;

                fastcgi_pass    backend;
        }
    }
```

nginx 使用 框架 codeigniter PATH_INFO SCRIPT_NAME 观察 分析 推理

更新于 2023年03月28日