25

I have Rails 3.2.3 with Apache and Passenger.

I have a project working in development mode. When I switch the project to production mode (Passenger standard) it gives me an HTTP Error 500:

We're sorry, but something went wrong.

This happens even with WEBrick. Can somebody help me?

Edit:

My production environment file: http://pastebin.com/ZAudSzkc

Lahiru Jayaratne
  • 1,684
  • 4
  • 31
  • 35
Michael Stark
  • 635
  • 2
  • 9
  • 17
  • Have you properly build your production envirnoment file.If yes then show me. – Kashiftufail May 09 '12 at 09:42
  • posted the production.rb in the main thread. but what do you mean by properly build? – Michael Stark May 09 '12 at 09:45
  • 1
    check the production log file which will give more information about the error – Soundar Rathinasamy May 09 '12 at 09:49
  • 4
    Production and development environments use different databases by default. As an option you should run `rake db:migrate RAILS_ENV=production` – ck3g May 09 '12 at 09:55
  • ck3g This was what I was missing! I am brand spankin new to Rails and I didn't see that in deploy instructions anywhere except for this comment. I really like Rails but it sure seems like documentation is scattered and has some holes. Still, I'll stick with it. – Dave Munger Feb 17 '15 at 09:23

4 Answers4

36

Make sure you have ran $ bundle install. If this doesn't succeed, go to your production environment and connect to your server using ssh and $ tail -f log/production.log in your current production app.

This will generate an output which might show an error.

If this doesn't show an error in the log/ directory do $ ls -la if there are any passenger.error files open the latest and check for errors there.

Hope this helped you out!


In addition to log/production.log, you should also look at the web server error log, typically /var/log/apache2/error.log or /var/log/nginx/error.log. Some errors are written there instead. More information can be found in the Troubleshooting section of the Passenger manual:

dsomel21
  • 576
  • 2
  • 8
  • 27
dennis
  • 2,000
  • 18
  • 26
22

I was struggling with a similar type of problem and found that by changing config.consider_all_requests_local to true in config/environments/production.rb, I could get the error message to display in production and see what the actual problem was. Obviously, change it back once you've fixed the problem.

Chrissy H
  • 461
  • 4
  • 12
  • 3
    This would provide a solution on new apps however I strongly suggest not using this method when you are hosting a high traffic application. just checking the stack trace of an error in your production.log is most clean. – dennis Mar 12 '13 at 15:25
  • A great suggestion to diagnose the underlying issue. Mine was `AssetNotFound` – antonkronaj Apr 10 '23 at 15:56
1

We faced the same problem, same message, 500 error code, but it was in development mode and nothing useful was logged. And it only happened at one of my colleges setup.

The problem were non-ASCII chars (here: umlauts like ü, ß and so on) within strings. We now simply translate everything with I18n.t('text_to_translate') (find the corresponding yaml translation file in /config/locales/, for more info on I18N see http://guides.rubyonrails.org/i18n.html).

0

I had a similar problem with django being installed in a passenger environment.

The problem for me was that in the passenger_wsgi.py file the path to the custom virtualenv Python installation was wrong.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263