2

我有一个在 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 文件放在类似的位置,我也不会在本地机器上遇到相同的错误。

4

1 回答 1

1

首先,感谢您的帖子。这促使我尝试重命名主目录中的 .htaccess 并解决了我面临的问题。

我现在在主目录的 .htaccess 文件中添加了一个重写条件,如下所示。

RewriteCond %{HTTP_HOST} !subdomain.example.com

您面临的问题可以通过http://httpd.apache.org/docs/2.2/mod/directive-dict.html#Context中的“上下文”来解释

于 2013-08-02T23:15:51.527 回答