# Radiant in Rails Production mode

**URL:** <https://www.ruby-forum.com/t/radiant-in-rails-production-mode/70637>\
**Category:** Radiant CMS\
**Created:** [October 1, 2006, 9:04am UTC](https://www.ruby-forum.com/t/radiant-in-rails-production-mode/70637 "2006-10-01T09:04:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnt519](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@johnt519](https://www.ruby-forum.com/u/johnt519)\
**Post date:** [October 1, 2006, 9:04am UTC](https://www.ruby-forum.com/t/radiant-in-rails-production-mode/70637/1 "2006-10-01T09:04:26Z")

</div>

Hi,

I had Radiant initially set up in (Rails) development mode. I wanted  
to switch it to production mode, for performance and to see if it  
fixed the header problem I’m having on the admin pages.

I thought all I needed to do was to add a line to my Apache config file:

SetEnv RAILS\_ENV production

I tried that, but the app was still in development mode (I could tell  
because it was using the dev database)

I had to change the line is the environment.rb file to get it to  
switch to production. Shouldn’t the change in the Apache config be  
enough? I’m running Ubuntu Linux and Apache 2.0.55

Thanks,

jt

(and still can’t figure out why I’m getting headers in the middle of  
the page :/)

---

<div class="post-metadata">

**Author:** ![johnt519](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@johnt519](https://www.ruby-forum.com/u/johnt519)\
**Post date:** [October 1, 2006, 5:02pm UTC](https://www.ruby-forum.com/t/radiant-in-rails-production-mode/70637/2 "2006-10-01T17:02:52Z")

</div>

On 01-Oct-2006 03:03 -0400, John T. was heard to say:

> SetEnv RAILS\_ENV production
> 
> I tried that, but the app was still in development mode (I could tell  
> because it was using the dev database)

Assuming you are using mod\_fastcgi, try to set:

FastCgiConfig -initial-env RAILS\_ENV=production

SetEnv happens on a per-request basis, but your Rails process starts in  
the  
context of Apache not that of a request.

Cheers,  
Oliver

---

<div class="post-metadata">

**Author:** ![johnt519](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@johnt519](https://www.ruby-forum.com/u/johnt519)\
**Post date:** [October 2, 2006, 12:15am UTC](https://www.ruby-forum.com/t/radiant-in-rails-production-mode/70637/3 "2006-10-02T00:15:44Z")

</div>

On 10/1/06, Oliver B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> SetEnv happens on a per-request basis, but your Rails process starts in the  
> context of Apache not that of a request.

Thanks. I’m actually using fcgid, so I’m not sure where to put the  
config. I see instructions to put

DefaultInitEnv RAILS\_ENV production

in the /etc/apache2/mods-enabled/fcgid.conf file, but I don’t want to  
enable production mode for all my rails apps. Can I put the  
DefaultInitEnv into the .htaccess?

Thanks again.

---

<div class="post-metadata">

**Author:** ![johnt519](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@johnt519](https://www.ruby-forum.com/u/johnt519)\
**Post date:** [October 3, 2006, 2:50am UTC](https://www.ruby-forum.com/t/radiant-in-rails-production-mode/70637/4 "2006-10-03T02:50:25Z")

</div>

On 10/1/06, John T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thanks again.

I ended up putting that line into the .htaccess file in my public  
folder and that did the trick.
