ruby-on-rails - Rails 生产 : Premature end of script headers

标签 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 安装的,所有 gem 都是最新的。

任何想法都会有所帮助!

最佳答案

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

关于ruby-on-rails - Rails 生产 : Premature end of script headers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27623924/

相关文章:

jquery - 使用 jQuery 和 AJAX 将参数从 Controller 传递到 javascript,以在 Ruby on Rails 中渲染 View

ruby-on-rails - RoR,Tire和Elasticsearch

php - 高性能服务器上的 Apache 响应时间慢

java - Tomcat - 无法打开日志 - 无法部署

linux - Ubuntu 16.04 : Error "Could not connect to archive.ubuntu.com:80 (91.189.88.152)" while running "apt-get update " command in a dockerfile

javascript - ubuntu 13.10 和 xampp linux 1.8.3 中的 sfRenderException

javascript - V8 中的 fatal error

ruby-on-rails - Rails factory_girl create_list 构建同一个对象

apache - 使 RewriteRule 可移植/相对于 .htaccess 文件的目录

php - 为 seo 优化和 google 引用重写 url