用户
 找回密码
 入住 CI 中国社区
搜索
12
返回列表 发新帖
楼主: 长江水
收起左侧

nginx 下CI访问 404 问题

[复制链接]
发表于 2015-8-7 09:28:15 | 显示全部楼层
接上面的  http://localhost/index.php/home/view/  中的 /home/view/ 其实应该是请求index.php文件时的参数 ,而不是index.php目录下的目录 。所以我们需要在nginx 中配置这个规则 。就是将url 重写。重写我不会啊 。我的理解是 我们应该将 /home/view/ 截取下来作为 http://localhost/index.php的参数 。
发表于 2015-8-7 11:25:45 | 显示全部楼层
xy631606923 发表于 2013-3-21 18:26
NGINX 默认不支持 PATH_INFO 模式,需要修改NGINX配置 让NGINX 来解析 index.php/controller/f 这种模式 具 ...

谢谢楼主 。看懂了 .+?  为 实际请求的文件 。 .+为后面的参数 。 谢谢 。 请看我下面的评论 ,我对nginx 的了解几乎为零。但我举得我下面的分析是对的。您觉得是这样的吗? 

发表于 2016-6-13 10:27:39 | 显示全部楼层
楼主找出原因了吗
发表于 2016-11-29 15:59:24 | 显示全部楼层
我也遇到相同的问题了,跪求大神解决呀
发表于 2016-11-29 16:09:08 | 显示全部楼层
我现在已经换车工apache 还是同样的问题
发表于 2016-11-29 16:27:36 | 显示全部楼层
初学者--- 发表于 2016-11-29 15:59
我也遇到相同的问题了,跪求大神解决呀

遇到问题要看具体是什么状况,要具体分析的。
发表于 2016-11-29 18:37:57 | 显示全部楼层
nignx开启重写功能

.htaccess里面<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule index.html$ index.php
    RewriteRule index-([1-9]+[0-9]*).html$ index.php?p=$1
    RewriteRule ([a-z]{1,})-([0-9]{1,}).html$ index.php?action=$1&id=$2
</IfModule>
发表于 2016-12-1 14:03:44 | 显示全部楼层
要看看你的nginx是什么版本,如果是新版(如:1.10以上),在location / 里面加入这个:
        index  index.php;
        try_files $uri $uri/ /index.php?$uri&$args;

完整如下:

location / {
        root   /root/www;
        index  index.php;
        try_files $uri $uri/ /index.php?$uri&$args;
    }
回复 支持 1 反对 0

使用道具 举报

发表于 2017-3-9 10:06:50 | 显示全部楼层
zhucheer 发表于 2014-8-25 13:59
**** 作者被禁止或删除 内容自动屏蔽 ****

请问你现在解决了吗

本版积分规则