Friday, December 10, 2010

modrails for development

This has got to be the best way I've ever seen to run Rails in development.  I admit I used WEBrick for way too long for development.  Setting up modrails is so simple, and doesn't require any special root privileges:

gem install passenger

My personal preference is for Nginx, so just run:

passenger-install-nginx-module

This will download the source code for latest stable version of Nginx (0.8.53 at time of writing) then build and configure it for you. All you need to do is setup v-hosts for all the Rails projects you are currently developing with the following snippet added to nginx.conf:

server {
listen 3000;
server_name localhost;
root /your-rails-project/public;
passenger_enabled on;

rails_env development;
}


Tips:

  • During Nginx install it in your user's home directory.
  • Run Nginx under your own username.
  • Remove any server configurations that listen on any port < 1024 to avoid root privileges.
  • root MUST point to the public directory of your Rails project.

No comments:

Post a Comment