# Recommendations for Apache 2 with mod\_fcgid

**URL:** <https://www.ruby-forum.com/t/recommendations-for-apache-2-with-mod-fcgid/94705>\
**Category:** Rails\
**Created:** [May 11, 2006, 7:44pm UTC](https://www.ruby-forum.com/t/recommendations-for-apache-2-with-mod-fcgid/94705 "2006-05-11T19:44:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [May 11, 2006, 7:44pm UTC](https://www.ruby-forum.com/t/recommendations-for-apache-2-with-mod-fcgid/94705/1 "2006-05-11T19:44:14Z")

</div>

Hi,

Have been pulling out my hair for the last few days wondering what I’m  
going to deploy my site onto.

I currently have FreeBSD 4.7, Apache 1.3.3, PHP 4 and MySQL 4 running a  
year-old PHP site. Dated stuff I know!

The new version of the site will be entirely Ruby on Rails, and I am  
wondering what order I should be doing things in terms of upgrades and  
installation. I want to be able to make changes to the server one at a  
time so that the existing site can continue running with minimal periods  
of downtime in between (very important!)

I’m thinking:

1. Upgrade Apache to 2.2 with mod\_fcgid running.
2. Check existing site runs fine for a while
3. Upgrade to MySQL 5
4. Check existing site runs fine for a while
5. After a while, bring down the old site and replace it with the Rails  
version
6. Reboot the server having turned off PHP.

Note that I have no plans to upgrade PHP, as with the new site, I can’t  
think of any immediate need for it.

Anyway, the above is incredibly major, risky stuff I know. Having  
multiple servers would be nice, but $$$ is a restriction. My questions  
are:

- Is the order of things above okay?

- Does anyone have any good 3rd party links for any of the above with  
regards to migration/installation/configuration tuning, especially in a  
RubyonRails setting? I will be following  
[http://journal.paul.querna.org/articles/2006/01/01/using-mod\_fcgid-for-ruby-on-rails-applications](http://journal.paul.querna.org/articles/2006/01/01/using-mod_fcgid-for-ruby-on-rails-applications)  
when it comes to configuring mod\_fcgid itself.

- Any other tips or alerts to my stupidity and inexperience on these  
issues would be most welcome too!

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [May 12, 2006, 6:42am UTC](https://www.ruby-forum.com/t/recommendations-for-apache-2-with-mod-fcgid/94705/2 "2006-05-12T06:42:36Z")

</div>

> > > > > “Andy” == Andy C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> I currently have FreeBSD 4.7, Apache 1.3.3, PHP 4 and MySQL 4 running a  
> year-old PHP site. Dated stuff I know!

> The new version of the site will be entirely Ruby on Rails, and I am  
> wondering what order I should be doing things in terms of upgrades and  
> installation. I want to be able to make changes to the server one at a  
> time so that the existing site can continue running with minimal periods  
> of downtime in between

I’m in a similar situation at the moment, and this is how I’m doing  
it:

- Make sure old Apache 1.3.x has mod\_proxy.

- Run new Rails app on PostgreSQL instead of MySQL.

- Put in a new vhost in the Apache config that proxies to a lighttpd  
that load-balances a Mongrel cluster.

## It’s really one layer of redirection too many, but it’s dead simple to set up and it doesn’t require touching the old application at all. Once the new Rails app has fully replaced the old stuff in production, one can always look at other deployment alternatives.

```
	     Calle D. <removed_email_address@domain.invalid>
	 http://www.livejournal.com/users/cdybedahl/

```

“You know, if I garbage collected my brain I wouldn’t have anything  
left.”  
– Paul Tomblin, BofhNet

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [May 12, 2006, 1:58pm UTC](https://www.ruby-forum.com/t/recommendations-for-apache-2-with-mod-fcgid/94705/3 "2006-05-12T13:58:58Z")

</div>

I was in a similar situation as you guys and decided on the following  
which  
has been running great

1. postgres instead of mysql
2. apache 2.2 with mod\_proxy\_balancer
3. mogrel instead of fcgi

much better and cleaner setup in my mind and definitely and edge in  
speed  
as well.

adam

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [May 12, 2006, 2:32pm UTC](https://www.ruby-forum.com/t/recommendations-for-apache-2-with-mod-fcgid/94705/4 "2006-05-12T14:32:24Z")

</div>

> > > > > “Adam” == Adam D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> 1. apache 2.2 with mod\_proxy\_balancer

## I’d try that, but I have a bunch of old mod\_perl stuff that I’d rather not try to port to mod\_perl2.

```
	     Calle D. <removed_email_address@domain.invalid>
	 http://www.livejournal.com/users/cdybedahl/

```

“Do any churches offer gluten-free body of christ? Just in case some  
of  
their flock have problems digesting their saviour?” – Rob Blake,  
BofhNet

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [May 12, 2006, 8:09pm UTC](https://www.ruby-forum.com/t/recommendations-for-apache-2-with-mod-fcgid/94705/5 "2006-05-12T20:09:38Z")

</div>

On May 12, 2006, at 9:53 AM, Andy C. wrote:

> 1. Best to stick with Apache 1.3, or the Pre-fork version of Apache  
> 2.2.  
> Given that it’ll just be like a doorman to lighty, I’m not sure  
> whether  
> its work the risk of an upgrade.

You’ll need Apache 2.2.x for proxy\_balancer if you’re going to use  
Mongrel.

With Mongrel, there’s little need for fcgid.

> 1. Why is everyone saying Postgres - is it really that much better for  
> Rails than MySQL.

It’s not better “for Rails” than MySQL, it’s just…NEVERMIND! Not  
starting  
a flame war today.

> 1. Do you guys keep your static files, e.g. CSS, JS, images in an  
> ‘unproxied’ directory so that Apache still serves it, as I here  
> this is  
> quicker than Lighty and some people do this.

See recent posts about Apache, Mongrel, mod\_proxy and  
mod\_proxy\_balancer.

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [May 12, 2006, 6:53pm UTC](https://www.ruby-forum.com/t/recommendations-for-apache-2-with-mod-fcgid/94705/6 "2006-05-12T18:53:45Z")

</div>

Thanks for the suggestions guys.

I’m thinking an Apache 1.3 to lighttpd proxy is probably a wiser choice  
for me, not only for the reasons you mention above but because I have  
the incredibly rock solid but ancient FreeBSD v4.7 installed.

I wanted to do the Apache 2.2 version with proxying to lighty, but that  
version (well, the quick MPM-Worker version) seems to rely on threading  
of some sort that FreeBSD 4.x doesn’t like. Therefore, I’d have to  
reinstall (remotely!) FreeBSD to v5/6 before doing the rest. For those  
in the know, you’ll know remotely installing FreeBSD is an invitation to  
disaster… a love letter to the Grim Reaper…

So, I think I’ll do the proxying with 1.3. However, I have a few  
specific questions if any of you have any guidance:

1. Best to stick with Apache 1.3, or the Pre-fork version of Apache 2.2.  
Given that it’ll just be like a doorman to lighty, I’m not sure whether  
its work the risk of an upgrade.

2. Why is everyone saying Postgres - is it really that much better for  
Rails than MySQL.

3. Do you guys keep your static files, e.g. CSS, JS, images in an  
‘unproxied’ directory so that Apache still serves it, as I here this is  
quicker than Lighty and some people do this.
