【发布时间】:2014-10-11 01:10:01
【问题描述】:
我有一个 PHP API,它依赖于 URL 路径 /api,在 OSX 上,以下配置可以正常工作:
location /api {
try_files $uri /api/index.php$is_args$args;
fastcgi_pass PHP:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
然而,Ubuntu 上的相同位置块似乎会导致:
[error] 9#0: *3 rewrite or internal redirect cycle while internal redirecting to "/api/index.php"
这与我是否显式调用 http://localhost/api/index.php、使用目录引用 http://localhost/api 或是否将一些参数传递给 index.php 脚本并调用如下调用无关:http://localhost/api/actions/recent。
谁能帮我理解为什么 Ubuntu 和 OSX 可能不同?如何解决这个重写错误?
可在此处找到 OSX 和 Ubuntu 的完整详细信息:
【问题讨论】:
-
添加了完整配置。 OSX 是单个文件,Ubuntu 使用 include 得出类似的结果。
-
在黑暗中拍摄,因为我没有看到真正的问题 - 您没有定义错误页面,并且套接字路径指向我在 ubuntu 上不期望的位置。
-
我的印象是错误路径,如果未定义,将简单地报告给访问日志。不是这样吗?
-
WRT 到套接字位于不寻常的位置...哎呀,这是一个剪切和粘贴错误。我已经更正了,因为 Ubuntu 连接使用的是 TCP 套接字而不是 Unix 套接字。
标签: nginx