2014-02-25 55 views
5

我不明白爲什麼會發生此錯誤:「重寫或內部重定向週期,同時內部重定向到」/index.html「」nginx - 重寫或內部重定向週期,同時內部重定向到「/index.html」

我發現了一個similar post並嘗試了基於我所閱讀的各種建議,但無濟於事。

這是我的nginx配置。任何幫助,將不勝感激!

server { 
    listen 80 default_server; 
    listen [::]:80 default_server ipv6only=on; 

    root /usr/share/nginx/html/public; 
    index index.php; 

    # Make site accessible from http://localhost/ 
    server_name ourdomain.com; 

    location @handler { 
     rewrite//index.php 
    } 

    location/{ 
     try_files $uri $uri/ /index.php?$query_string; 
    } 

    location ~ .php$ { 
     fastcgi_split_path_info ^(.+.php)(/.+)$; 
     fastcgi_pass unix:/var/run/php5-fpm.sock; 
     fastcgi_index index.php; 
     include fastcgi_params; 
     # add the following line in for added security. 
     try_files $uri =403; 
    } 
} 

回答

5

好了解決了。問題是

location @handler { 
    rewrite//index.php 
} 

刪除它,一切都很好。

+2

您需要添加「;」在這一行的末尾:rewrite//index.php –

1

這是對服務器故障更好的要求。

它看起來像/index.html匹配/index.php?$query_string,這是傳遞給PHP,我猜從那裏重定向回到/index.html

我真的不能給你更多的信息,雖然因爲你的問題沒有指定請求的URL,我對你的應用中可能的重定向一無所知。