歡迎您光臨本站 註冊首頁

求助一個nginx下的rewrite寫法,請大家進來看看

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

求助一個nginx下的rewrite寫法,請大家進來看看

我先來說一下我的環境  我裝的是nginx/0.6.35  應用程序是基於開源框架ThinkPHP 寫的。
我的nginx配置為
server {
        listen  222.186.33.116:80;
        server_name  www.ibugao.cn;

        access_log  /var/log/nginx/localhost.access.log;

        location / {
                root   /var/www/nginx-default/ibugaocn;
                index  index.html index.php index.htm;
               rewrite ^/(.*)$ /index.php/$1 last;
             }

        location /doc {
                root   /usr/share;
                autoindex on;
                allow 127.0.0.1;
                deny all;
        }

        location /images {
                root   /var/www/nginx-default/ibugaocn;
                autoindex on;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root   /var/www/nginx-default/ibugaocn;
        }
location ~ \.php$ {

                   fastcgi_pass 127.0.0.1:9000;
                   fastcgi_index index.php;
                   set $path_info "";
                   set $real_script_name $fastcgi_script_name;
                   if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                        set $real_script_name $1;
                        set $path_info $2;
                   }
                   fastcgi_param SCRIPT_FILENAME /var/www/nginx-default/ibugaocn$real_script_name;
                   fastcgi_param SCRIPT_NAME $real_script_name;
                   fastcgi_param PATH_INFO $path_info;
                   include /etc/nginx/fastcgi_params;
                  }

    }

我在線的問題是 www.ibugao.cn訪問 就變成  500 Internal Server Error
訪問www.ibugao.cn/index.php 可以訪問 但點擊鏈接就會500錯誤 偽路徑是http://www.ibugao.cn/Admin-index   實際路徑是 http://www.ibugao.cn/Admin/index


我在貼下錯誤路徑

2009/07/21 09:31:18 [error] 16667#0: *73 rewrite or internal redirection cycle while processing "/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/", client: 59.62.65.216, server: www.ibugao.cn, request: "GET / HTTP/1.1", host:

2009/07/21 09:32:52 [error] 16667#0: *93 rewrite or internal redirection cycle while processing "/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/Admin/index", client: 59.62.65.216, server: www.ibugao.cn, request: "GET /Admin/index HTTP/1.1", host: "www.ibugao.cn"

2009/07/21 09:32:44 [error] 16667#0: *86 rewrite or internal redirection cycle while processing "/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/Admin-index", client: 59.62.65.216, server: www.ibugao.cn, request: "GET /Admin-index HTTP/1.1", host: "www.ibugao.cn", referrer: "http://www.ibugao.cn/index.php"



在線等 有什麼情況不清楚的 我再補充~
《解決方案》

自己頂~
《解決方案》

繼續頂起
《解決方案》

我還在繼續!!!!!!!
《解決方案》

幫忙頂上去!:m01: :m01:
《解決方案》

謝謝 樓上的 壓力好大  自己一邊找原因 一邊找幫助·
《解決方案》

server {
        listen  222.186.33.116:80;
        server_name  www.ibugao.cn;
              index  index.html index.php index.htm;
       root   /var/www/nginx-default/ibugaocn;

        access_log  /var/log/nginx/localhost.access.log;


        location /doc {
                root   /usr/share;
                autoindex on;
                allow 127.0.0.1;
                deny all;
        }

        location /images {
                root   /var/www/nginx-default/ibugaocn;
                autoindex on;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root   /var/www/nginx-default/ibugaocn;
        }
location ~ \.php$ {

                   fastcgi_pass 127.0.0.1:9000;
                   fastcgi_index index.php;
                   set $path_info "";
                   set $real_script_name $fastcgi_script_name;
                   if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                        set $real_script_name $1;
                        set $path_info $2;
                   }
                   fastcgi_param SCRIPT_FILENAME /var/www/nginx-default/ibugaocn$real_script_name;
                   fastcgi_param SCRIPT_NAME $real_script_name;
                   fastcgi_param PATH_INFO $path_info;
                   include /etc/nginx/fastcgi_params;
                  }
               rewrite ^/(.*)$ /index.php/$1 last;

[火星人 ] 求助一個nginx下的rewrite寫法,請大家進來看看已經有788次圍觀

http://coctec.com/docs/service/show-post-21560.html