Rails生产:脚本标题的过早结束

时间:2014-12-23 16:06:51

标签: ruby-on-rails apache ubuntu ruby-on-rails-4 passenger

我正在尝试在vps上托管我的rails应用程序。我遇到的问题是当我尝试导航到我的rails应用程序时,我收到以下错误消息:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

当我签出虚拟服务器的错误日志时,它会告诉我以下内容:

Premature end of script headers:

有时接下来是feedcontactreferer: myurl.com/或根本没有。

我在其他地方看到过很多关于此错误消息的帖子,但到目前为止还没有解决此事。普遍的共识似乎是它可能与rails环境变量或文件有关。

由于这是我第一次尝试将rails应用程序放在生产服务器上,我认为这是合情合理的。以下是我的environment.rb

cat config/environment.rb 
# Load the Rails application.
require File.expand_path('../application', __FILE__)

# Initialize the Rails application.
Rails.application.initialize!

至于服务器,我正在使用带有Webmin / Virtualmin的Ubuntu 12.04和带乘客的apache2。 Ruby 2.1.5p273是使用RVM安装的,所有宝石都是最新的。

任何想法都会有所帮助!

1 个答案:

答案 0 :(得分:1)

今天我遇到了完全相同的问题。在我的例子中,它是'secret_key_base:<%= ENV [“SECRET_KEY_BASE”]%>'在config / secrets.yml中(但是env变量未在服务器上定义)。请查看http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html的§3.3。