Php nginx-内部重定向到“时重写或内部重定向循环”/index.html“;

Php nginx-内部重定向到“时重写或内部重定向循环”/index.html“;,php,redirect,nginx,Php,Redirect,Nginx,我无法找出发生此错误的原因:“在内部重定向到“/index.html”时重写或内部重定向循环” 我找到了一个,并根据我读到的内容尝试了各种建议,但都没有用 这是我的nginx配置。任何帮助都将不胜感激 server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html/public; index index.php;

我无法找出发生此错误的原因:“在内部重定向到“/index.html”时重写或内部重定向循环”

我找到了一个,并根据我读到的内容尝试了各种建议,但都没有用

这是我的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;
    }
}

好的,我决定了。问题是

location @handler {
    rewrite / /index.php
}

删除它,一切又恢复正常。

最好在服务器出现故障时询问此问题

看起来/index.html与正在传递给php的
/index.php?$query\u string
匹配,我猜会从那里重定向回
/index.html

不过,我不能给你更多的信息,因为你的问题没有指定请求URL,我对你的应用程序中可能的重定向一无所知。

你需要在这一行的末尾添加“;”:rewrite//index.php