Rails 应用程序仅在开发模式下运行,无需登录生产环境

Rails 应用程序仅在开发模式下运行,无需登录生产环境

我已经创建了超级简单的 Rails 应用程序

rails test
cd test/
script/generate controller home index
rm public/index.html

# uncommented map.root :controller => "home" in config/routes.rb

当我在开发模式下运行应用程序时,它运行良好,并且所有内容都会被记录下来

<VirtualHost *:80>
    DocumentRoot /opt/rails/test/public

    ErrorLog /opt/rails/test/log/error.log
    CustomLog /opt/rails/testlog/access.log combined

    RailsEnv development
</VirtualHost>

但是当我切换到 RailsEnv 生产时,

RailsEnv production

我收到这个丑陋的错误页面

We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.

并且在 error.log 或 production.log 中都没有任何内容,但是在 access.log 中,我可以看到正在记录的请求。

我正在运行 Ubuntu x64 Jaunty。

答案1

您应该从 github 安装 ssl_requirement 插件。在生产环境中运行时,您会收到一封包含错误消息/会话转储等的电子邮件。

http://github.com/rails/ssl_requirement/tree/master

另外,命令“rm public/index.php”应该是“rm public/index.html”。

我会检查 /var/log/apache2 中的日志,以确保您没有遗漏任何内容。我知道日志应该位于您的自定义目录中,但是...

相关内容