Webricks vs Apache

Webricks is the name of Ruby on Rails’ built-in web server, which is sometimes also referred to as script/server because that’s how you run it. It has its advantages and disadvantages over configuring Apache to run with Ruby support.

        <span id="more-3136"></span>

Advantages

  • You don’t have to mess with Apache’s Rewrite rules or anything to get started
  • Webricks is really easy to start
  • It’s kind of cool to have your Rails app be its own server. Just because.

Disadvantages

  • It’s pretty slow compared to Apache set up with FastCGI.
  • It can’t run on port 80 (regular HTTP) if you’re already running another web server, or another Rails app, so you get either ugly URLs or you can’t run other web sites.
  • For the same reason as above, it’s not virtual host friendly.

Have it Both Ways

There’s no reason you can’t develop your Rails app using Webricks and then switch it over to Apache for production. This is super convenient, because you can develop on your home machine without bothering with Apache if you don’t want to.

Starting Webricks

You have to start Webricks for each Rails app you want to run. To start it, go to the directory where your application lives. Not sure where that is? It’s the place where you typed: rails /directory/to/myapp Once you’re there, type the following: ruby script/server

Conclusion

There you have it, in a nutshell. I’m sure there’s more to know about it, but I haven’t gotten that far yet. I haven’t really managed to get Apache set up with Rails, FastCGI or no, but once I do, I’ll revisit this topic.

Hey, why not get a shiny
Freckle Time Tracking
account?