On Jan 4, 2006, at 9:39 AM, Steve L. wrote:
which is
Steve L.
Steve-
You have a few different options for hosting multiple rails apps on
one linux box. If you absolutely need apache then you go ahead and
kep apache running on port 80. Then you can run lighttpd for each of
your rails apps on a different port and proxy the requests thru
apache. Or you can just run lighttpd and use its vhost capabilities
to run different apps.
Lets assume you want to use the apache->prox->lighttpd/fcgi method
for now. Here are some example vhosts for apache that will proxy thru
to lighttpd on a high port:
Apache 1.3.x:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ProxyPass / http://localhost:8000/
ProxyPassReverse / http://localhost:8000/
Apache 2.x:
<VirtualHost :80>
ServerAdmin [email protected]
ServerName example.com:80
ProxyRequests Off
ProxyPreserveHost On
RewriteEngine On
RewriteRule ^/(.) http://127.0.0.1:3000/$1 [P,L]
ProxyPassReverse / http://127.0.0.1:3000/
Then you can run one lighttpd instance for each rails app each on
its own port. This gives you the advantage that you can restart each
rails app individually without affecting the other apps. Also once
you install lighttpd and make sure it is in your $PATH, script/server
will use lighttpd instead of webrick by default. So all you need to
do is install lighttpd and then run each of your apps behind an
apache vhost by setting a port number for each app and then using
this line to start each rails app:
$ script/server -e production -p 8000 # or whatever you want for each
app.
Hope that helps you out a bit. This is one area of rails
documentation that is sorely lacking. All the info is fragmented
across a hundred blogs and each of these blogs contradict each other
in some ways. So I am happy to tell you that I am writing a “Rails
Deployment” book for the Pragmatic Programmers as we speak. Look for
a beta pdf version in March.
Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
[email protected]
PS. You can find more helpful info on rails configuration and
deployment on my blog at:
http://brainspl.at