codeigniter在nginx下返回404 not found

codeigniter框架需要path_info的支持,Apache默认支持path_info,但是nginx默认不支持,我们需要设置nginx,使得nginx支持path_info

网上试了好多方法最总才解决希望对大家有所帮助:(我的mac版的,具体设置看你们的需要,把重点的红色显示)

 server {

        listen       8080;

        server_name  localhost;

        location / {

           # root   /usr/local/var/www/;

           # index  index.html index.htm index.php;

            if (-f $request_filename) {

                expires max;

                break;

            }

            if (!-e $request_filename) {

                rewrite ^(.*)$ /wechat/index.php?$1 last;

                break;

               # rewrite ^/(.*)$ /wechat/index.php/$1 last;

               # break;          注意:网上好多是用 index.php/$1 应该是 ? 这个要注意了

            }

        }

       # error_page   500 502 503 504  /50x.html;

        location = /50x.html {

           root   /usr/local/var/www;

        }

        location ~ \.php$ {

            root           /usr/local/var/www;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

            include        fastcgi_params;

        }

        location ~ /\.ht {

            deny  all;

        }

    }

 

rewrite or internal redirection cycle while processing "/wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php/server", client: 127.0.0.1, server: localhost, request: "GET /wechat/index.php/server HTTP/1.1", host: "127.0.0.1:8080"

rewrite 重复了10次 并不是 break 的问题

 这个问题就是上面说的 / 改为 ? 即可。 

 

转载于:https://www.cnblogs.com/chaihy/p/8718255.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值