backwang 发表于 2012-8-17 10:06:33

在NGINX上部署CI问题

大家好:

      遇到一个老生常谈却又无法解决的问题,望支招,先谢谢!

环境:用的集成环境PHPSYS,带nginx1.1.18和php5.3.10,安装了一个codeigniter.org.cn里下载的stblog-0.1.2博客系统,在默认nginx.conf的配置下还可以打开各页面(域名后带INDEX.PHP尾巴),我想把这个INDEX.PHP给去掉,博客系统里的CONFIG.PHP配置如下:
$config['base_url'] = "http://localhost/blog/";
$config['index_page'] = "";
$config['uri_protocol'] = "PATH_INFO";
nginx.conf的配置如下:
server {
index index.php index.htm;
server_namelocalhost;
root    html;
location / {
    if (!-e $request_filename) {
      rewrite ^/(.*)$ /index.php/$1 last;
    }
}
location /index.php {
    fastcgi_pass   127.0.0.1:9000;
    include      fastcgi_params;
    fastcgi_paramSCRIPT_FILENAME    /html/blog/index.php;
}
}
现在我输入http://localhost/blog看首页直接就
404 Not Found或是no input file这种提示,请问我该如何配置nginx.conf,网上找了N多种配置,什么 开启PATHINFO这些,我都弄了,总之要吗就404这些错,要吗就是INDEX.PHP这个尾巴去不掉,原来我在APACHE上用:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /mvc/index.php/$1
我就可以直接去掉尾巴。
求解,谢谢

pirate9413 发表于 2012-10-17 15:09:45

不得不承认,这点,ci 做的很烂

流年、 发表于 2012-11-28 13:21:47

关CI毛事情?这是Nginx服务器的解析问题好不

bluelomo 发表于 2012-11-28 13:57:18

$config['uri_protocol'] = "PATH_INFO";

这个是不是有4个选项?依次换换

qingbofish 发表于 2013-1-16 16:17:55

bluelomo 发表于 2012-11-28 13:57 static/image/common/back.gif
$config['uri_protocol'] = "PATH_INFO";

这个是不是有4个选项?依次换换

CI1.7.X系列的,应该选择REQUEST_URI才行。

edgeto 发表于 2015-5-6 17:18:01

location / {
            index index.php;
            if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php?$1 last;
                break;
            }   
      }
页: [1]
查看完整版本: 在NGINX上部署CI问题