【问题标题】:Things to know when replacing WEBrick by Thin用 Thin 替换 WEBrick 时要知道的事情
【发布时间】:2013-02-08 17:57:58
【问题描述】:

我打算在 Rails 3.2 项目中将 WEBrick 替换为 Thin,因为 WEBrick 处理格式错误的未转义 URI 很糟糕(bad URI 错误)。我知道有一些配置技巧可以让 WEBrick 处理未转义的 URI,但只需将 gem 'thin' 添加到我的 Gemfile 中似乎很容易,这让我想知道:

  • 如果我这样做,我的应用程序是否会出现问题?

顺便说一句:我正在 Heroku 上进行部署。如果 Heroku 上的 Thin 存在特定问题,那么我也想知道。

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 heroku thin webrick


    【解决方案1】:

    如果您的 Gemfile 中有 Thin,rails s 应该以 Thin 开头。例如,我正在开发的应用程序在 Gemfile 的开发组中很薄:

    rails s
    => Booting Thin
    => Rails 3.2.14 application starting in development on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
    

    【讨论】:

      【解决方案2】:

      不.. Rails 就是这么简单! :)

      只要确保您开始使用:

      thin start
      

      【讨论】:

      • 对于rails,我会养成这样做的习惯:rails s thin。对于生产,像 Heroku 这样的东西确实捆绑了 exec rails s thin.
      • 刚刚用 Thin 做了一个快速测试,奇怪的是,它解决了我在开发中的糟糕 URI 问题,但在 Heroku 的生产中却没有。而且我确信 Heroku 已经使用 Thin 重新启动。任何想法为什么会发生这种情况?
      • 检查您的生产日志以确保服务器以瘦启动。
      • 它是:=== web:bundle exec thin start -R config.ru -e $RAILS_ENV -p $PORTweb.1: up 2013/02/08 19:37:03 (~ 31m ago)
      猜你喜欢
      • 2011-12-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-31
      • 1970-01-01
      • 1970-01-01
      • 2012-04-11
      • 2023-03-19
      • 1970-01-01
      相关资源
      最近更新 更多