nginx problem "We're sorry, but something went wrong."

I try to create a production server and follow the instructions in this document

However, my Rails Application can not work properly, and I get a error message, “We’re sorry, but something went wrong.”.

If I browse my application’s home page, it works.

If I stop nginx server and use WEBrick instead, it works fine.

Following is my /opt/nginx/conf/nginx.conf

I use Virtualbox 4.1.12 to create the production server
Host OS is Mac OS X 10.7.3
Guest OS is Ubuntu 8.04 Server

Here is my Virtualbox Image,

username: rubyonrailsserver
password: rubyonrailsserver

Following are my instructions to install the production server

install ubuntu server

echo “alias ll=‘ls -l’” >> ~/.bash_aliases

edit .bashrc and uncomment the loading of .bash_aliases

sudo apt-get update
sudo apt-get upgrade

sudo dpkg-reconfigure tzdata

sudo apt-get install ntp

sudo ntpdate # Update time

sudo hostname your-hostname

Add your-hostname
sudo vim /etc/hosts

Write your-hostname in
sudo vim /etc/hostname

sudo apt-get install mysql-server libmysqlclient15-dev

Add the following lines to ~/.gemrc, this will speed up gem installation and prevent rdoc and ri from being generated, this is not nessesary in the production environment.

Hey Vincent

Your logs would contain a stack trace of what exactly the error was. Could you send that?

Started GET “/posts” for at Thu May 03 17:59:14 +0800 2012

Processing by PostsController#index as HTML

Rendered posts/index.html.erb within layouts/application (0.3ms)

Completed 500 Internal Server Error in 2ms

ActionView::Template::Error (application.css isn’t precompiled):



4: Testapp

5: <%= stylesheet_link_tag “application”, :media => “all” %>

6: <%= javascript_include_tag “application” %>

7: <%= csrf_meta_tags %>


app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__186315690_75549250’

app/controllers/posts_controller.rb:7:in `index’

Hi Aziz,

Many thanks for the advice, above is the error in my log, and I found a solution,

You will get better performance in production if you set config.assets.compile to false in production.rb and precompile your assets. You can precompile with this rake task:

bundle exec rake assets:precompile

If you are using Capistrano, version 2.8.0 has a recipe to handle this at deploy time. For more info, see the “In Production” section of the Asset Pipeline Guide: