我有一个在 apache2+phusion_passenger 上运行的 rail3 应用程序。直到几天前我突然开始收到以下错误时,一切都运行得非常顺利:
[Mon May 13 11:43:16 2013] [error] [client 54.228.16.0] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon May 13 11:43:16 2013] [debug] core.c(3063): [client 54.228.16.0] r->uri = /blog/index.php
[Mon May 13 11:43:16 2013] [debug] core.c(3069): [client 54.228.16.0] redirected from r->uri = /blog/index.php
[Mon May 13 11:43:16 2013] [debug] core.c(3069): [client 54.228.16.0] redirected from r->uri = /blog/index.php
[Mon May 13 11:43:16 2013] [debug] core.c(3069): [client 54.228.16.0] redirected from r->uri = /blog/index.php
[Mon May 13 11:43:16 2013] [debug] core.c(3069): [client 54.228.16.0] redirected from r->uri = /blog/index.php
[Mon May 13 11:43:16 2013] [debug] core.c(3069): [client 54.228.16.0] redirected from r->uri = /blog/index.php
[Mon May 13 11:43:16 2013] [debug] core.c(3069): [client 54.228.16.0] redirected from r->uri = /blog/index.php
[Mon May 13 11:43:16 2013] [debug] core.c(3069): [client 54.228.16.0] redirected from r->uri = /blog/index.php
[Mon May 13 11:43:16 2013] [debug] core.c(3069): [client 54.228.16.0] redirected from r->uri = /blog/index.php
[Mon May 13 11:43:16 2013] [debug] core.c(3069): [client 54.228.16.0] redirected from r->uri = /blog/index.php
[Mon May 13 11:43:16 2013] [debug] core.c(3069): [client 54.228.16.0] redirected from r->uri = /index.php
这是我的 apache vhost 配置的样子:
<VirtualHost *:80>
ServerAdmin "webmaster@xyz.com"
ServerName analytics.xyz.com
ServerAlias www.analytics.xyz.com
MIMEMagicFile /dev/null
CustomLog logs/analytics_access.log "%t %>s %b %D %h \"%r\" %u \"%{Referer}i\" \"%{User-Agent}i\""
ErrorLog logs/analytics_error.log
LogLevel debug
DocumentRoot "/home/sysadmin/analytics/public"
<Directory "/home/sysadmin/analytics/public">
AllowOverride All
Options -MultiViews
</Directory>
</VirtualHost>
经过一番挠头后,我发现里面有一个.htaccess
导致/home/sysadmin
这个问题的东西。我删除了这个文件,一切又开始工作了。
现在这是我的问题。为什么 apache/passenger 正在读取不在 documentroot 中的 .htaccess 文件。系统上还有其他虚拟主机都指向目录/home/sysadmin/specific_dir,但没有指向/home/sysadmin/。
另一件事是,即使我将相同的 .htaccess 文件放在类似的位置,我也不会在本地机器上遇到相同的错误。