nginx - 内部重定向到"/index.html"时重写或内部重定向循环



我无法弄清楚为什么会发生此错误:"内部重定向到"/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 正在匹配 /index.php?$query_string ,它正在传递给 php,我猜从那里重定向回 /index.html .

不过,我真的无法为您提供更多信息,因为您的问题没有指定请求 URL,而且我对应用程序中可能的重定向一无所知。

最新更新