乘客阅读.htaccess从外面轨道documentroot

时间:2013-05-13 07:03:57

标签: ruby-on-rails ruby-on-rails-3 apache passenger

我在apache2 + phusion_passenger上运行了一个rails3应用程序。一切都很顺利,直到几天我才突然开始出现以下错误:

[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读取.htaccess文件不在文档中。系统上还有其他vhost都指向diretories / home / sysadmin / specific_dir但没有指向/ home / sysadmin /.

另一件事是,即使我将相同的.htaccess文件放在类似的位置,我也不会在本地计算机上出现相同的错误。

1 个答案:

答案 0 :(得分:1)

首先,感谢帖子。这促使我尝试重命名主目录中的.htaccess,我遇到的问题已经解决。

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

RewriteCond %{HTTP_HOST} !subdomain.example.com

您遇到的问题可以通过http://httpd.apache.org/docs/2.2/mod/directive-dict.html#Context

中的“上下文”来解释