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 的问题

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

  • 相关阅读:
    mysql索引类型 normal, unique, full text
    16.信号量互斥编程
    15.信号通信编程
    14.有名管道通信
    13.无名管道通讯编程
    12.多进程程序的操作
    11.进程控制理论
    10.时间编程
    9. 库函数方式文件编程
    8.Linux文件编程
  • 原文地址:https://www.cnblogs.com/chaihy/p/8718255.html
Copyright © 2011-2022 走看看