开发者

New Rails + Passenger deployment half working...not sure why?

I'm in the final stages of going round trip through the entire Rails cycle: development -> test -> production (on an external server). I'm very close...but seeing some errors with the production version and don't know enough about Rails' "magic" to troubleshoot it yet...

this works: www.mydomain.com/rails and returns my app's view

but this: www.mydomain.com/rails/ returns (in its entirety):

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

Where is this coming from!?! I've ruled out Apache. as Apache wouldn't return that kind of html as an index of a directory...

Added: VirtualHost (per request):

<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>


My guess is that apache has directory browsing enabled and passenger is routing this request to the public folder which in turn is going to apache direct.

You can try

  1. Disabling directory browsing by disabling Options Indexes (omitting Indexes)
  2. You possibly catch a route in your routes.rb file to that path explicitly and route it to where you wish.


For the second one, does it work if you do www.mydomain.com/rails/mycontroller/show/1?

If it works with "show" in between mycontroller and 1, there's a problem with your routes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜