How do you configure WEBrick to use SSL in Rails?

While the scripts directory in Rails 4 is gone, the bin directory remains. You can get WEBrick working with an SSL certificate by editing the bin/rails script. Tested on Rails 4 and Ruby 2.1.1, installed with rbenv. Much of this is from this blog post and this Stack Overflow question. #!/usr/bin/env ruby require ‘rails/commands/server’ require … Read more

How to set Thin as default in Rails 3

I sent a pull request on the Github repository of rack and it was accepted: https://github.com/rack/rack/commit/b487f02b13f42c5933aa42193ed4e1c0b90382d7 In a near future, we will be able to use Thin just by adding gem ‘thin’ to our Gemfile and starting app with rails s. Note that this may be a temporary measure, however. I chose Thin because Mongrel … Read more

Why would I want to use unicorn or thin instead of WEBrick for development purposes?

It is important to develop as closely as possible to the production environment. It helps ensure that an application will work as expected when deployed into production, instead of stumbling upon bugs at runtime. This issue is alleviated with the use of Continuous Testing on a Build server that replicates the production environment. Even though … Read more

Why does Ruby on Rails use http://0.0.0.0:3000 instead of http://localhost:3000?

Localhost means quite literally “your local host”, usually identified by 127.0.0.1 and all traffic to that address is routed via a loopback interface. If your Web server is listening for connections on 127.0.0.1, this means that it only accepts requests coming from the same host. 0.0.0.0 means that Rails is listening on all interfaces, not … Read more

Webrick as production server vs. Thin or Unicorn?

A couple important reasons it’s written in Ruby (see http://github.com/ruby/ruby/tree/trunk/lib/webrick) Edited it doesn’t have many features that a production website usually needs, like multiple workers (in particular, pre-forking, life cycle management, asynchronous handling, etc), redirects, rewriting, etc When I mention redirects/rewrites, I’m referring to the fact that using Webrick, you have to handle rewrites at … Read more