zoukankan      html  css  js  c++  java
  • 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 的问题

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

  • 相关阅读:
    【42.38%】【BZOJ 3196】二逼平衡树
    【7.89%】【BNUOJ 52303】Floyd-Warshall
    【37.38%】【codeforces 722C】Destroying Array
    【57.14%】【codeforces 722B】Verse Pattern
    【26.34%】【codeforces 722A】Broken Clock
    HNOI2008越狱(快速幂)
    HNOI2010弹飞绵羊
    JSOI2008最大数(线段树)
    ZJ2008树的统计(树链剖分)
    SDOI 2010 and SXOI 2014 地精部落 (递推)
  • 原文地址:https://www.cnblogs.com/chaihy/p/8718255.html
Copyright © 2011-2022 走看看