Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from stackoverflow.com Sep 2 '12 at 19:56

This question came from our site for professional and enthusiast programmers.

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.

share|improve this answer
    
Yes, I think it's running in production mode. production.log file exists and the recent logs are in that file. The most recent log is this: Connecting to database specified by database.yml Started GET "/" for 147.xxx.xxx.xxx at 2012-08-30 16:51:04 +0900 Processing by StaticPagesController#home as HTML Rendered static_pages/home.html.erb within layouts/application (29.0ms) Completed 500 Internal Server Error in 62ms ActionView::Template::Error (logo.png isn't precompiled) app/views/static_pages/home.html.erb:8:in `_app_views_static_pages_home_html_erb__2032549551898309484_28916320' – user1633983 Aug 30 '12 at 7:54
    
Wow, after inspecting the log file, I googled with keyword "isn't precompiled", and I modified config/environments/production.rb file's "config.assets.compile = false" to true. It works but I'm not sure is it OK to let that configuration be true. – user1633983 Aug 30 '12 at 7:59
    
I realized that I need to precompile assets before deploy. For newbies , just like me, who will read this article later, I tried in this way: in config/environments/production.rb, I uncommented "config.assets.precompile" line and added css/js files I want to precompile. and let "config.assets.compile" be false.(Googling tells me that letting that line be true is not recommended.) and execute the command "RAILS_ENV=production RAILS_GROUPS=assets rake assets:clean tmp:clear assets:precompile && touch tmp/restart.txt". And it seems to work well. – user1633983 Aug 30 '12 at 8:16
1  
@user1633983 if you think, that your solution will help future users, please post your comments as an answer to this question – oers Aug 30 '12 at 12:01

Add:

RailsEnv development

or:

RailsEnv production

to vhost

then restart.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.