2014-02-25 56 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,我对你的应用中可能的重定向一无所知。