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

在NGINX上部署CI问题

[复制链接]
发表于 2012-8-17 10:06:33 | 显示全部楼层 |阅读模式
大家好:

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

环境:用的集成环境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_name  localhost;
  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_param  SCRIPT_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 [L]
我就可以直接去掉尾巴。
求解,谢谢
发表于 2012-10-17 15:09:45 | 显示全部楼层
不得不承认,这点,ci 做的很烂
发表于 2012-11-28 13:21:47 | 显示全部楼层
关CI毛事情?  这是Nginx服务器的解析问题好不
发表于 2012-11-28 13:57:18 | 显示全部楼层
$config['uri_protocol'] = "PATH_INFO";

这个是不是有4个选项?依次换换
发表于 2013-1-16 16:17:55 | 显示全部楼层
bluelomo 发表于 2012-11-28 13:57
$config['uri_protocol'] = "PATH_INFO";

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

CI1.7.X系列的,应该选择REQUEST_URI才行。
发表于 2015-5-6 17:18:01 | 显示全部楼层
location / {
            index index.php;
            if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php?$1 last;
                break;
            }   
        }

本版积分规则