Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails App Error: Premature end of script headers

My setup: Ubuntu 12.04 LTS, Apache, Phusion Passenger, latest Ruby and Rails.

When I visit my website, I get a 500 Internal Server Error. Error Logfiles: Premature end of script headers

Does somebody know how to solve that problem?

like image 400
crispychicken Avatar asked Jan 19 '13 22:01

crispychicken


2 Answers

Just posting here in case other people have the same problem as I did.

I followed the Rails tutorial and part of that tutorial was making sure the secret_token was generated dynamically (listing 3.2 in the link) as a .secret file in the application root.

The problem was that the application somehow didn't write a token to the file, so I took the value from my development .secret, modified it, and saved it on the server. That made my application work in production.

like image 125
JesperB Avatar answered Sep 26 '22 02:09

JesperB


If you have a database configured for production in your config/database.yml that doesn't exist on the server as you mentioned in the comments, that could be the source of your issue since it's failing to establish a database connection.

Remove that connection from your config/database.yml and restart your app.

like image 22
deefour Avatar answered Sep 23 '22 02:09

deefour