0

我正处于整个 Rails 周期往返的最后阶段:开发 -> 测试 -> 生产(在外部服务器上)。我非常接近......但是看到生产版本存在一些错误,并且对 Rails 的“魔法”了解不足,无法对其进行故障排除......

这有效:www.mydomain.com/rails并返回我的应用程序的视图

但这:www.mydomain.com/rails/返回(全部):

<html>
<body>
Index from public
</body>
</html>

这是哪里来的!?!我已经排除了 Apache。因为 Apache 不会返回那种 html 作为目录的索引......

补充: VirtualHost(每个请求):

<VirtualHost *:80>
    ServerName www.mydomain.com
    ServerAdmin admin@mydomain.com
    DocumentRoot "/Library/WebServer/mydomainweb"
    DirectoryIndex "index.html" "index.php"
    CustomLog "/var/log/apache2/access_log" "%h %l %u %t \"%r\" %>s %b"
    ErrorLog "/var/log/apache2/error_log"
    ErrorDocument 404 /error.html
    <IfModule mod_ssl.c>
        SSLEngine Off
        SSLCertificateFile "/etc/certificates/Default.crt"
        SSLCertificateKeyFile "/etc/certificates/Default.key"
        SSLCipherSuite "ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:!SSLv2:+EXP:+eNULL"
    </IfModule>
    <IfModule mod_dav.c>
        DAVLockDB "/var/run/davlocks/.davlock100"
        DAVMinTimeout 600
    </IfModule>
    <IfModule mod_mem_cache.c>
        CacheEnable mem /
        MCacheSize 4096
    </IfModule>
    <Directory "/Library/WebServer/mydomainweb">
        AllowOverride None
        <IfModule mod_dav.c>
            DAV On
        </IfModule>
        Options All -Includes -ExecCGI +MultiViews -Indexes
    </Directory>
    RailsBaseURI /rails
    <Directory /Library/WebServer/rails/myapp/public>
        Options -MultiViews -Indexes
    </Directory>
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{REQUEST_METHOD} ^TRACE
        RewriteRule .* - [F]
    </IfModule>
    <IfModule mod_proxy_balancer.c>
        <Proxy "balancer://balancer-group">
        </Proxy>
    </IfModule>
    <IfModule mod_alias.c>
        Alias "/collaboration" "/usr/share/collaboration"
        Alias "/icons/" "/usr/share/httpd/icons/"
        Alias "/error/" "/usr/share/httpd/error/"
        Redirect temp "/zapp.html" "/index.html"
    </IfModule>
    Include /etc/apache2/httpd_groups.conf
    Include /etc/apache2/httpd_teams_required.conf
    LogLevel warn
    ServerAlias mydomain.com
    ServerAlias images.mydomain.com
</VirtualHost>
4

2 回答 2

0

我的猜测是 apache 启用了目录浏览,并且乘客正在将此请求路由到公用文件夹,而公用文件夹又将直接发送到 apache。

你可以试试

  1. 通过禁用选项索引(省略索引)禁用目录浏览
  2. 您可能会在您的 routes.rb 文件中明确捕获到该路径的路由并将其路由到您希望的位置。
于 2010-06-18T05:29:38.513 回答
0

对于第二个,如果您执行 www.mydomain.com/rails/mycontroller/show/1 是否有效?

如果它与 mycontroller 和 1 之间的“show”一起使用,则说明您的路线有问题。

于 2010-06-18T08:54:54.987 回答