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?
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?
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.
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.
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.
Ok. I encountered exactly the same problem using dreamhost VPS.
I was doing 2 mistakes. Firstly i didnt run "bundle exec rake db:migrate" in production mode, i.e "bundle exec rake db:migrate RAILS_ENV=production"
but this problem still kept showing up. Then i tried Jesper8 answer. I ran "rake secret" and copied the secret token to config/secrets.yml file infront of "production: secret_key_base: "
Restarted my app and it worked
Hope this might help someone facing similar problem
Make sure you environment is development:
RailsEnv development
Add to Virtualhost config
© 2022 - 2024 — McMap. All rights reserved.
Premature end of script headers
this is in your apache logs, and is pretty useless on it's own. Do your rails logs give you any better information? – Pearlypearman