Multiple Rails apps with SCGI?


#1

I have two different Rails directories and I’m trying to get scgi to
serve both of them. There
don’t appear to be any docs on how to do this. I thought perhaps it was
cluster, but that appears
to be just for concurrent connections in the same Rails directory. As it
is now, I can get my
first Rails directory to work, but the second just displays ‘bad
gateway’ errors. I’ve started
scgi in both Rails directories. I guess the missing link is in Lighty’s
config, but I don’t know
how to make requests for specific hosts go to specific scgi servers. My
lighty config:

scgi.server = ( “dispatch.scgi” => ((
“host” => “127.0.0.1”,
“port” => 9999,
“check-local” => “disable”,
“disable-time”=>0
)) )

I also played around with clusters:

scgi.server = (
“dispatch.scgi” => (
“server1” => (
“host” => “127.0.0.1”,
“port” => 9999,
“check-local” => “disable”,
“disable-time” => 0
),
“server2” => (
“host” => “127.0.0.1”,
“port” => 10000,
“check-local” => “disable”,
“disable-time” => 0
),
“server3” => (
“host” => “127.0.0.1”,
“port” => 10001,
“check-local” => “disable”,
“disable-time” => 0
),
“server4” => (
“host” => “127.0.0.1”,
“port” => 10100,
“check-local” => “disable”,
“disable-time” => 0
)
)
)

I set scgi in the second Rails directory to use port 10100. But I still
get ‘bad gateway’ errors.
I’ve tried everything I can think of and still can’t get it to work. Has
anybody been able to get
scgi to serve different Rails directories?

thanks for any help,
csn


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


#2

Hi, CSN,

don’t know how to do it with lighty, but I’m running multiple scgi apps
as VirtualHosts on Apache. Therefore I’m starting scgi_ctrl start with
different ports on the different directorys and define the SCGI-Mounts
in VirtualHost-directives that serve these directories. Maybe this is an
option for you.

regards
Jan


#3

You need to make vhosts in lighttpd.conf for each rails app. So make
one of these sections for each rails app with a different domain
name. Here is a sample. vhost:

$HTTP[“host”] =~ “(www.)?example.com” {
server.document-root = “/home/username/railsapp/public/”
server.error-handler-404 = “/dispatch.scgi”
server.indexfiles = ( “index.php”, “index.html”,
“index.htm”, “default.htm” )
scgi.debug=0
scgi.server = ( “dispatch.scgi” => ((
“host” => “127.0.0.1”,
“port” => 9999,
“check-local” => “disable”,
“disable-time”=>0
)) )

}

Cheers-
-Ezra

On Dec 10, 2005, at 1:00 PM, CSN wrote:

how to make requests for specific hosts go to specific scgi

  "port" => 10000,
  "host" => "127.0.0.1",

work. Has anybody been able to get
Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

-Ezra Z.
WebMaster
Yakima Herald-Republic Newspaper
removed_email_address@domain.invalid
509-577-7732


#4

Aaahh… that was the missing link. Thanks!

I was curious to see if I could put scgi’s config params in just one
vhost, and hopefully the
global scgi params would be the default for all other vhosts that didn’t
have scgi config stuff.
Doesn’t appear to work - the vhost with scgi params worked, but the
others displayed 404 errors.

csn

— Ezra Z. removed_email_address@domain.invalid wrote:

scgi.server = ( “dispatch.scgi” => ((

scgi in both Rails directories. I guess the missing link is in

"server2" => (
),

still get ‘bad gateway’ errors.
http://mail.yahoo.com
509-577-7732


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


#5

Also, you can use different local IP’s, keeping the ports the same. Try
127.0.0.2, 127.0.0.3, etc.


#6

On Dec 10, 2005, at 2:59 PM, CSN wrote:

csn

CSN-

Take a look at mod_simple_vhost. with that you can have a fall back

rails app for when nothing else matches.

Cheers-
-Ezra

server.indexfiles = ( “index.php”, “index.html”,

As it is now, I can get my
“check-local” => “disable”,
“check-local” => “disable”,
“port” => 10001,
)


WebMaster


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

-Ezra Z.
WebMaster
Yakima Herald-Republic Newspaper
removed_email_address@domain.invalid
509-577-7732