Rails + FastCgi + Production?

I’m new (1 day) to DreamHost, and relatively new to Rails and FastCgi. I noticed that in development mode my pages are taking as much as 4 seconds to load. Given the strict guidelines on CPU time used, I want to get this switched to production mode, as I’ve heard it’s significantly faster. My question is, how do I do this? I’ve looked all over the internet for information about putting Rails + FastCgi into production mode, and everything seems to assume that you’re running your own server… unless I start making a ton of money from my website (not likely) I won’t be running my own server.

I assume I put something into .htaccess, but what?

First, check the DreamHost wiki:


In particular, you need to enable fastcgi for your domain.

To force your app into production you can edit your environment.rb file:

RAILS_ENV = ENV[‘RAILS_ENV’] || ‘production’

They are looking into setting this via your .htaccess file, but I’m not sure if that works yet or not. You can try it by adding this:

SetEnv RAILS_ENV production

I have a few other odds and ends about rails at DreamHost:



Yeah, I read that somewhere, but I thought it was something to be avoided unless absolutely necessary…

Oh well, since the .htaccess thing may not be in yet (and if it’s new I don’t wanna mess with it), I’ll just do it that way. Thanks!

tried that, seems to work, but still as slow as hell , may even be slower :frowning:

DreamHost is currently switching the default over to production mode. Now if you want an app to be in development you’ll need:

RAILS_ENV = ‘development’

E.g, yank out ‘ENV[‘RAILS_ENV’] ||’ or it will set you in production mode.

If you’re still running slowly, triple check that your .htaccess file is pointing to dispatch.fcgi and that your account is configured for fast cgi… (obvious, but it happens…)


-Tom Wilcoxen