2
votes

I decided just recently to implement my RoR project in a production experimental environment. The problem I'm experiencing is when trying to view my main app page, apache would show the content of public directory instead.

Important notes:

  1. I have deleted the index.html file from public (before, apache would show the rails welcome page)
  2. I have a map root route in my route.rb - that used to perfectly work in my dev envronment.

    map.root :controller => 'home'

  3. I'm using the virtual host file that was automatically created by capistrano deployment under /etc/apache2/sites-available/appname

    its Content:

    NameVirtualHost specific.ip.address:80

    ServerName specific.ip.address

    DocumentRoot /var/www/appname/current/public

Dev environment (in which everything works fine):

Ruby and Rails installed on my macbook pro using the default mongrel configuration

Experimental production environment (where I'm experiencing the problem):

  1. Ubuntu 9.04 32 bit
  2. Rails, Ruby, Apache, git (local), passenger and capistrano were installed and configured following the instructions in : http://hackd.thrivesmarthq.com/how-to-setup-a-linux-server-for-ruby-on-rails-with-github-and-phusion-passenger

  3. all steps went fine including the capistrano deployment which successfully deployed my app under: /var/www/appname/current/

  4. as detailed above, when trying to view my main app page - apache would show the content of my public dir (even though I don't have index.html and I have a map root route that worked in dev)

Regards, Jason

1
In addition, when I'm trying to navigate directly to my home view using: "ip_address/home" "ip_address/home/index" "ip_address/appname/home" "ip_address/appname/home/index" I'm getting the Error 404 page. - Jason Edward
Did you restart apache? Also check out articles.slicehost.com. Their tutorials cover pretty much everything and are very well done. - mark
It seems like the request is not being handled by Passenger. When you copied the LoadModule text did you start a new line before RailsSpawnServer and RailsRuby? What version of Passenger are you using because that syntax is different than what I used for version 3. - Brian Deterling
Thanks for you comments. Mark, I did restart my apache. Brian, I think the request is handled by passenger, check out the error 404 page I'm getting is served by passenger (when specifying home/index) "Not Found The requested URL /appname/home was not found on this server. Apache/2.2.11 (Ubuntu) Phusion_Passenger/2.0.3 Server at ip_address Port 80" - Jason Edward

1 Answers

3
votes

add

Options -Indexes 

to a directory configuration settings in your virtualhost. Either in

<Directory />
    Options -Indexes 
</Directory>

or in your document root

<Directory /var/www/appname/current/public>
    Options -Indexes 
</Directory>