user1402455
user1402455

Reputation: 117

Why does rails app show /public index listing instead of actual app?

How do you set up apache to show the rails app once it is on the server? My rails app works perfectly on the localhost, but when I go to the external site it gives me the index information

like this

Name    Last modified   Size    Description
[TXT]   404.html    21-May-2012 21:38   728      
[TXT]   422.html    21-May-2012 21:38   711      
[TXT]   500.html    21-May-2012 21:38   643      
[IMG]   favicon.ico 21-May-2012 21:38   0    
[TXT]   robots.txt  21-May-2012 21:38   204      

This is my virtual host information

<VirtualHost *:80>
      ServerAdmin [email protected]
      ServerName server.example.com
      # ServerAlias
      DocumentRoot /var/www/sample_app/current/public
      ErrorLog /var/www/sample_app/error.log

          RailsEnv production
        <Directory "/var/www/sample_app/current/public">
          Options Indexes FollowSymLinks MultiViews
          Order allow,deny
          Allow from all
        </Directory>
</VirtualHost>

Upvotes: 3

Views: 2553

Answers (1)

Olivier Lance
Olivier Lance

Reputation: 1748

OK that might not be it, but here's what Passenger's documentation recommends:

<VirtualHost *:80>
    ServerName www.mycook.com
    DocumentRoot /webapps/mycook/public
    <Directory /webapps/mycook/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

It's clearly stated that MultiViews is not compatible with Passenger.

So you could try:

  • Removing the Indexes option
  • Specifying -MultiViews instead of MultiViews

To be honest, I've tried adding Indexes to a production app of mine, as I thought that might just be this option that caused the problem, but it didn't change anything... so it's a bit of a "wild guess" that it might fix things on your side.

UPDATE From another answer, what you could try is adding the PassengerResolveSymlinksInDocumentRoot option:

<VirtualHost *:80>
    ServerName www.mycook.com
    DocumentRoot /webapps/mycook/public
    <Directory /webapps/mycook/public>
        Allow from all
        Options -MultiViews
        PassengerResolveSymlinksInDocumentRoot on
    </Directory>
</VirtualHost>

Upvotes: 6

Related Questions