Rails application error: invalid end of script headers

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

When I visit my site, I get 500 internal server errors. Error log files: invalid end of script headers

Does anyone know how to solve this problem?

+7
source share
4 answers

If you have a database configured for production in config/database.yml that does not exist on the server, as you mentioned in the comments, this may be the source of your problem because you cannot connect to the database.

Remove this connection from config/database.yml and restart the application.

+4
source

Just post here if other people have the same problem as mine.

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

The problem was that the application somehow did not write the token to the file, so I took the value from my development .secret , changed it and saved it on the server. This made my application work in production.

+8
source

Ok I ran into exactly the same problem using dreamhost VPS.

I made 2 mistakes. Firstly, I did not run "bundle exec rake db: migrate" in production mode, i.e. "Bundle exec rake db: migrate RAILS_ENV = production"

but this problem still manifested itself. Then I tried to answer Jesper8. I ran "rake secret" and copied the secret token into the config / secrets.yml infront file "production: secret_key_base:"

Restarted my application and it worked

Hope this helps someone facing a similar issue.

0
source

Make sure the environment is development:

RailsEnv development

Add to Virtualhost config

-one
source

All Articles