微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – nginx – 重写或内部重定向循环,同时内部重定向到“/index.html”

我无法弄清楚为什么会发生这种错误:“内部重定向到”/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;
    }
}

解决方法:

好的解决了.问题是

location @handler {
    rewrite / /index.PHP
}

删除它,一切都很好.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐