# RoR and Growing Pains

**URL:** <https://www.ruby-forum.com/t/ror-and-growing-pains/55432>\
**Category:** Rails\
**Created:** [March 21, 2006, 1:10am UTC](https://www.ruby-forum.com/t/ror-and-growing-pains/55432 "2006-03-21T01:10:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rogelio\_JSSamour](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@Rogelio\_JSSamour](https://www.ruby-forum.com/u/Rogelio_JSSamour)\
**Post date:** [March 21, 2006, 1:10am UTC](https://www.ruby-forum.com/t/ror-and-growing-pains/55432/1 "2006-03-21T01:10:29Z")

</div>

I have persuaded my company to move towards an RoR shop… from a PHP 5  
(with in-house-built framework)… so the jump is not terribly bad. I’m  
REALLY excited actually!

My problem: I am overwhelmed with all the setup Loops I have to jump  
through to get RoR setup. I tried it on my current Apache 1.34 and  
decided it’d be easier to make the Lighty (1.4.11) jump. So I did. I get  
it working fine as per all the nice HowTos out there… but it only  
works for one single Virtual Host. Namely: [http://localhost/test/](http://localhost/test/) but if  
I wanted to add a second one I had to add to [http://mylappy/newapp](http://mylappy/newapp)

Both being on the same box but added to my /etc/hosts file…

Could I just setup mod\_userdir and have ALL my Rails apps be under  
/home/ro/public\_html/ ?? (I’ve tried something to this effect  
but I am too green in Lighty to know where I’m wrong)

This is my sample vhost (Lighty) I simply repeat it for my other app:

```
142 $HTTP["host"] == "fxonrails" {
143 server.document-root = "/home/rsamour/test/public/"
144 accesslog.filename = "/home/rsamour/test/log/access.log"
145 server.indexfiles = ( "dispatch.fcgi", "index.html" )
146 server.error-handler-404 = "/dispatch.fcgi"
147
148 # rails stuff
149 #### fastcgi module
150 fastcgi.server = (
151 ".fcgi" => (
152 "test" => (
153 "socket" => "/tmp/test1.socket",
154 "bin-path" =>

```

“/home/rsamour/test/public/dispatch.fcgi”,  
155 “min-procs” =\> 1,  
156 “max\_procs” =\> 2  
157 )  
158 )  
159 )  
160 }

Thanks in advance,

-ro-

---

<div class="post-metadata">

**Author:** ![Rogelio\_JSSamour](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@Rogelio\_JSSamour](https://www.ruby-forum.com/u/Rogelio_JSSamour)\
**Post date:** [March 21, 2006, 1:18am UTC](https://www.ruby-forum.com/t/ror-and-growing-pains/55432/2 "2006-03-21T01:18:17Z")

</div>

You’ve about got it. If you do something like this then you can have  
multiple subdirectories on one host. The next item will have a  
different $HTTP[“url”] as I’m sure you can imagine.

## MAGNET

$HTTP[“host”] == “[www.railsconsulting.com](http://www.railsconsulting.com)” {  
$HTTP[“url”] =~ “^/magnet” {  
var.appname = “magnet”  
server.document-root = “/var/www/” + var.appname +  
“/current/public”  
alias.url = ( “/magnet” =\> “/var/www/” + var.appname +  
“/current/public” )  
server.error-handler-404 = “/magnet/dispatch.fcgi”  
fastcgi.server = ( “.fcgi” =\>  
( var.appname =\>  
( “min-procs” =\> 1,  
“max-procs” =\> 1,  
“socket” =\> “/tmp/” + var.appname + “.fcgi.socket”,  
“bin-path” =\> “/var/www/” + var.appname +  
"/current/public/dispatch.f$  
“bin-environment” =\> ( “RAILS\_ENV” =\> “production” ),  
)  
)  
)

Michael

---

<div class="post-metadata">

**Author:** ![Rogelio\_JSSamour](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@Rogelio\_JSSamour](https://www.ruby-forum.com/u/Rogelio_JSSamour)\
**Post date:** [March 21, 2006, 1:26am UTC](https://www.ruby-forum.com/t/ror-and-growing-pains/55432/3 "2006-03-21T01:26:56Z")

</div>

Michael:

Thanks… the problem that I’m trying to solve is that I used to be  
able to say: [http://dev/~user1/app1/](http://dev/~user1/app1/) or [http://dev/~user1/app2/](http://dev/~user1/app2/) or  
[http://dev/~user2/app1/](http://dev/~user2/app1/) and it just work… Your magnet example works  
great for production but I’m wanting (if possible) to get the  
Development side working… Would it still be the same way as you  
illustrated? Thanks for the advice and patience! 🙂

-ro-

---

<div class="post-metadata">

**Author:** ![Rogelio\_JSSamour](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@Rogelio\_JSSamour](https://www.ruby-forum.com/u/Rogelio_JSSamour)\
**Post date:** [March 21, 2006, 2:42am UTC](https://www.ruby-forum.com/t/ror-and-growing-pains/55432/4 "2006-03-21T02:42:42Z")

</div>

Someone more knowledgeable than I will have to help you out here. I  
don’t see how it’s possible with the way things are laid out with a  
rails app, but then again, I’m just figuring this stuff out. Good  
luck, and if you figure something out, let me know. I’d be interested  
as well.

Michael

---

<div class="post-metadata">

**Author:** ![Rogelio\_JSSamour](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@Rogelio\_JSSamour](https://www.ruby-forum.com/u/Rogelio_JSSamour)\
**Post date:** [March 21, 2006, 1:34am UTC](https://www.ruby-forum.com/t/ror-and-growing-pains/55432/5 "2006-03-21T01:34:43Z")

</div>

Rogelio J. Samour wrote:

> I have persuaded my company to move towards an RoR shop… from a PHP 5  
> (with in-house-built framework)… so the jump is not terribly bad. I’m  
> REALLY excited actually!
> 
> My problem: I am overwhelmed with all the setup Loops I have to jump  
> through to get RoR setup. I tried it on my current Apache 1.34 and  
> decided it’d be easier to make the Lighty (1.4.11) jump. So I did. I get

Just a note about setup choices you mentioned:

- Apache 1.34 will be slower than Apache 2.x (MPM-Worker) and  
Lighttpd-1.4.x.
- Lighttpd-1.4.11 has issues with SSL when using fastcgi but it works  
great for me otherwise

If you decided to go with Apache 2.x, then I recommend Apache-2.0.55  
(MPM-Worker), mod\_fcgid-1.08, and mod\_security-1.9.2. Don’t use  
mod\_fastcgi-2.4.x unless you are running Apache 1.x.

Also, if you use MPM-Prefork with Apache 2.0, it will be slow as Apache  
1.x–so try Apache2’s MPM-Worker to see if it works for you because it  
will be similar to Lighttpd speed.

---

<div class="post-metadata">

**Author:** ![Rogelio\_JSSamour](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@Rogelio\_JSSamour](https://www.ruby-forum.com/u/Rogelio_JSSamour)\
**Post date:** [March 21, 2006, 5:29am UTC](https://www.ruby-forum.com/t/ror-and-growing-pains/55432/6 "2006-03-21T05:29:39Z")

</div>

Take a look at what I worked out in this thread:

[Rails] hosting multiple rails apps in one webroot?
