500 error with deploying rails application via apache2+passenger

apache-2.2phusion-passengerruby-on-railsruby-on-rails-3

I finally completed my own app, so the only work left is deploying the app.

I'm using Ubuntu 10.04 and apache2(installed by apt-get), so I'm trying to deploy through passenger.

I installed passenger gem like this:

sudo gem install passenger
rvmsudo passenger-install-apache2-module

and I configured apache settings as what the installation message says.

I added below lines in the middle of /etc/apache2/apache2.conf file.

LoadModule passenger_module /home/admin/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
PassengerRoot /home/admin/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17
PassengerRuby /home/admin/.rvm/wrappers/ruby-1.9.3-p194/ruby

and, I appended below lines in /etc/apache2/sites-available/default file.

<VirtualHost *:80>
  ServerName localhost
  # !!! Be sure to point DocumentRoot to 'public'!
  DocumentRoot /home/admin/homepage/public
  <Directory /home/admin/homepage/public>
     # This relaxes Apache security settings.
     AllowOverride all
     # MultiViews must be turned off.
     Options -MultiViews
  </Directory>

But when I restart the apache service and hit the address, 500 error occurs.

At first, it was same 500 error but the 500 error page is from apache's, but when I reinstalled the libapache2-module-passenger, the 500 error page is changed to that from rails'.

Because of rails' 500 error page(which is located at public/500.html), I think passenger module is properly connected with apache.

What should I do to fix this problem?

Do I need to configure something inside my app before deployment?

Best Answer

You need to configure database connection and install all necessary gems (bundle install). Check out what logs are telling about your problem, you can find it in log/ dir in a root path of your application.

Do you run it in production mode?
You need to define development mode in your apache config otherwise it will be production mode.