Well,
one strange work-around I found was to make use of this mechanism:
$HTTP["host"] == "mac2" { ... }
Usually we tie 1 hostname to the ethernet card on a host.
But...
If I tie 2 hostnames to my ethernet card,
I can ''connect'' the 2nd hostname to the second rails app.
On my Mac I tied "mac2" to 127.0.0.1 by editing /etc/hosts
Then, I added this syntax to the lighttpd.conf which ties
the 2nd hostname to the rails app.
$HTTP["host"] == "mac2" {
server.document-root = "/tmp/app2/public"
server.errorlog = "/tmp/app2" +
"/log/lighttpd.error.log"
accesslog.filename = "/tmp/app2" +
"/log/lighttpd.access.log"
fastcgi.server = ( ".fcgi" => ( "localhost" => (
"min-procs" => 1,
"max-procs" => 1,
"socket" => "/tmp/app2" +
"/tmp/sockets/fcgi.socket",
"bin-path" => "/tmp/app2" +
"/public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ENV" =>
"development" )
) ) )
}
And...
the rails app at /tmp/app2
behaves the way I want.
-Dan
On 8/22/06, Dan Bikle <dan.bikle@gmail.com> wrote:>
> Team,
>
> I''m trying to figure out how to run 2 rails apps on one host.
>
> I ran an experiment:
>
> cd /tmp/
> rails app1
> rails app2
> cd app1
> script/server
>
> rails put a copy of lighttpd.conf in
> /tmp/app1/config/
> and then started lighttpd
>
> http://localhost:3000
> gave me the splash page.
>
> I shutdown the server
>
> I added something to
> /tmp/app1/config/lighttpd.conf
>
> server.modules = ( "mod_rewrite",
"mod_accesslog",
> "mod_fastcgi", "mod_compress", "mod_expire",
"mod_alias" )
>
> Then I added 1 other thing:
>
>
> $HTTP["url"] =~ "^/app2" {
> alias.url = ( "/app2" => CWD + "/../app2/public" )
> server.error-handler-404 = "/dispatch.fcgi"
> server.document-root = CWD + "/../app2/public/"
> server.errorlog = CWD +
"/../app2/log/lighttpd.error.log"
> accesslog.filename = CWD +
"/../app2/log/lighttpd.access.log"
>
> fastcgi.server = ( ".fcgi" => ( "localhost"
=> (
> "min-procs" => 1,
> "max-procs" => 1,
> "socket" => CWD +
"/../app2/tmp/sockets/fcgi.socket",
> "bin-path" => CWD +
"/../app2/public/dispatch.fcgi",
> "bin-environment" => ( "RAILS_ENV" =>
"development",
> "RAILS_RELATIVE_URL_ROOT" => "/app2" )
> ) ) )
>
> }
>
> I ran script/server from /tmp/app1 to start lighttpd.
>
> It came up fine.
>
> I tried
> http://localhost:3000/
>
> I got the rails splash page as before.
>
> I tried
> http://localhost:3000/app2/index.html
>
> I got the rails splash page
>
> I tried
> http://localhost:3000/app2/
>
> I got a 404 error.
>
> Why is it ignoring the index.html in
> /tmp/app2/public/
> ???
>
>
> I looked in the error log for app2.
>
> I saw:
>
> 2006-08-22 21:39:12: (log.c.75) server started
> 2006-08-22 21:39:58: (connections.c.1394) Warning: Either the
> error-handler returned status 404 or the error-handler itself was not
found:
> /dispatch.fcgi
> 2006-08-22 21:39:58: (connections.c.1396) returning the original status
> 404
> 2006-08-22 21:39:58: (connections.c.1398) If this is a rails app: check
> your production.log
>
> I shutdown lighttpd.
>
> I tinkered with a variety of settings in
> /tmp/app1/config/lighttpd.conf
>
> I couldn''t get app2 to "see" index.html unless I typed
it into the URL.
>
> Can any of you give me some tips on how I might force lighttpd to see
> index.html ?
>
> Related question:
>
> How do I force app1 to ignore /app2/ as a route ?
>
> Thanks,
>
> -Dan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060823/77b31e29/attachment.html
Here is info about my Rails version: bash mac maco /tmp/app1 114 $ bash mac maco /tmp/app1 114 $ bash mac maco /tmp/app1 114 $ script/about About your application''s environment Ruby version 1.8.4 (powerpc-darwin8.7.0) RubyGems version 0.8.11 Rails version 1.1.6 Active Record version 1.14.4 Action Pack version 1.12.5 Action Web Service version 1.1.6 Action Mailer version 1.2.5 Active Support version 1.3.1 Application root /private/tmp/app1 Environment development Database adapter mysql bash mac maco /tmp/app1 115 $ bash mac maco /tmp/app1 115 $ bash mac maco /tmp/app1 115 $ bash mac maco /tmp/app1 115 $ -Dan On 8/23/06, Dan Bikle <dan.bikle@gmail.com> wrote:> > Well, > > one strange work-around I found was to make use of this mechanism: > > $HTTP["host"] == "mac2" { ... } > > Usually we tie 1 hostname to the ethernet card on a host. > > But... > If I tie 2 hostnames to my ethernet card, > I can ''connect'' the 2nd hostname to the second rails app. > > On my Mac I tied "mac2" to 127.0.0.1 by editing /etc/hosts > > Then, I added this syntax to the lighttpd.conf which ties > the 2nd hostname to the rails app. > > > $HTTP["host"] == "mac2" { > server.document-root = "/tmp/app2/public" > server.errorlog = "/tmp/app2" + "/log/lighttpd.error.log" > accesslog.filename = "/tmp/app2" + "/log/lighttpd.access.log" > > > > fastcgi.server = ( ".fcgi" => ( "localhost" => ( > "min-procs" => 1, > "max-procs" => 1, > "socket" => "/tmp/app2" + "/tmp/sockets/fcgi.socket", > "bin-path" => "/tmp/app2" + "/public/dispatch.fcgi", > "bin-environment" => ( "RAILS_ENV" => "development" ) > ) ) ) > > } > > > And... > the rails app at /tmp/app2 > behaves the way I want. > > -Dan > > > On 8/22/06, Dan Bikle <dan.bikle@gmail.com> wrote: > > > > Team, > > > > I''m trying to figure out how to run 2 rails apps on one host. > > > > I ran an experiment: > > > > cd /tmp/ > > rails app1 > > rails app2 > > cd app1 > > script/server > > > > rails put a copy of lighttpd.conf in > > /tmp/app1/config/ > > and then started lighttpd > > > > http://localhost:3000 > > gave me the splash page. > > > > I shutdown the server > > > > I added something to > > /tmp/app1/config/lighttpd.conf > > > > server.modules = ( "mod_rewrite", "mod_accesslog", > > "mod_fastcgi", "mod_compress", "mod_expire", "mod_alias" ) > > > > Then I added 1 other thing: > > > > > > $HTTP["url"] =~ "^/app2" { > > alias.url = ( "/app2" => CWD + "/../app2/public" ) > > server.error-handler-404 = "/dispatch.fcgi" > > server.document-root = CWD + "/../app2/public/" > > server.errorlog = CWD + "/../app2/log/lighttpd.error.log" > > accesslog.filename = CWD + "/../app2/log/lighttpd.access.log" > > > > fastcgi.server = ( ".fcgi" => ( "localhost" => ( > > "min-procs" => 1, > > "max-procs" => 1, > > "socket" => CWD + "/../app2/tmp/sockets/fcgi.socket", > > "bin-path" => CWD + "/../app2/public/dispatch.fcgi", > > "bin-environment" => ( "RAILS_ENV" => "development", > > "RAILS_RELATIVE_URL_ROOT" => "/app2" ) > > ) ) ) > > > > } > > > > I ran script/server from /tmp/app1 to start lighttpd. > > > > It came up fine. > > > > I tried > > http://localhost:3000/ > > > > I got the rails splash page as before. > > > > I tried > > http://localhost:3000/app2/index.html > > > > I got the rails splash page > > > > I tried > > http://localhost:3000/app2/ > > > > I got a 404 error. > > > > Why is it ignoring the index.html in > > /tmp/app2/public/ > > ??? > > > > > > I looked in the error log for app2. > > > > I saw: > > > > 2006-08-22 21:39:12: (log.c.75) server started > > 2006-08-22 21:39:58: (connections.c.1394) Warning: Either the > > error-handler returned status 404 or the error-handler itself was not found: > > /dispatch.fcgi > > 2006-08-22 21:39:58: (connections.c.1396) returning the original status > > 404 > > 2006-08-22 21:39:58: (connections.c.1398) If this is a rails app: check > > your production.log > > > > I shutdown lighttpd. > > > > I tinkered with a variety of settings in > > /tmp/app1/config/lighttpd.conf > > > > I couldn''t get app2 to "see" index.html unless I typed it into the URL. > > > > Can any of you give me some tips on how I might force lighttpd to see > > index.html ? > > > > Related question: > > > > How do I force app1 to ignore /app2/ as a route ? > > > > Thanks, > > > > -Dan > > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060823/d60f0820/attachment-0001.html
Team,
I''m trying to figure out how to run 2 rails apps on one host.
I ran an experiment:
cd /tmp/
rails app1
rails app2
cd app1
script/server
rails put a copy of lighttpd.conf in
/tmp/app1/config/
and then started lighttpd
http://localhost:3000
gave me the splash page.
I shutdown the server
I added something to
/tmp/app1/config/lighttpd.conf
server.modules = ( "mod_rewrite", "mod_accesslog",
"mod_fastcgi",
"mod_compress", "mod_expire", "mod_alias" )
Then I added 1 other thing:
$HTTP["url"] =~ "^/app2" {
alias.url = ( "/app2" => CWD + "/../app2/public" )
server.error-handler-404 = "/dispatch.fcgi"
server.document-root = CWD + "/../app2/public/"
server.errorlog = CWD + "/../app2/log/lighttpd.error.log"
accesslog.filename = CWD + "/../app2/log/lighttpd.access.log"
fastcgi.server = ( ".fcgi" => ( "localhost" => (
"min-procs" => 1,
"max-procs" => 1,
"socket" => CWD +
"/../app2/tmp/sockets/fcgi.socket",
"bin-path" => CWD +
"/../app2/public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ENV" =>
"development",
"RAILS_RELATIVE_URL_ROOT" => "/app2" )
) ) )
}
I ran script/server from /tmp/app1 to start lighttpd.
It came up fine.
I tried
http://localhost:3000/
I got the rails splash page as before.
I tried
http://localhost:3000/app2/index.html
I got the rails splash page
I tried
http://localhost:3000/app2/
I got a 404 error.
Why is it ignoring the index.html in
/tmp/app2/public/
???
I looked in the error log for app2.
I saw:
2006-08-22 21:39:12: (log.c.75) server started
2006-08-22 21:39:58: (connections.c.1394) Warning: Either the error-handler
returned status 404 or the error-handler itself was not found:
/dispatch.fcgi
2006-08-22 21:39:58: (connections.c.1396) returning the original status 404
2006-08-22 21:39:58: (connections.c.1398) If this is a rails app: check your
production.log
I shutdown lighttpd.
I tinkered with a variety of settings in
/tmp/app1/config/lighttpd.conf
I couldn''t get app2 to "see" index.html unless I typed it
into the URL.
Can any of you give me some tips on how I might force lighttpd to see
index.html ?
Related question:
How do I force app1 to ignore /app2/ as a route ?
Thanks,
-Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060823/f6c5d5df/attachment-0001.html