Apache - Rails communication

Please, if this question is not appropriate to this list please direct
me elsewhere. If it has been discussed in a previous thread, please
direct me there. An initial search of the archives did not appear to
show anything.

I am new to Rails but not to app servers having 4 years with J2EE.

The set up of a Rails app seams strait forward and I understand the
MVC model. Initial test code has all worked fine.

This question has to do with Rails / web server configuration.

I want to run standard Apache serving the site. I want to serve the
rails app on a separate port, often not even on the same machine but
on the same LAN. I want to direct requests to the Rails app and have
the Rails app direct a response back to the Apache server. This
would have the Rails app running under either WEBrick or Mongrel. I
have had good luck getting the Rails apps up and responding to
requests directly.

How can I get those requests / responses traveling between Apache and
the Rails web server? Is there example code of such a configuration?

All comments welcome
john

On Mar 22, 2006, at 7:09 AM, John N. Alegre wrote:

This question has to do with Rails / web server configuration.
the Rails web server? Is there example code of such a configuration?

All comments welcome
john


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

John-

Here are a few example apache vhosts that use the proxypass and

rewrite modules to send requests on port 80 to a local or remote
rails app running on a higher port. These will help you do what you
want.

Apache 1.3.x:

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ProxyPass / http://example.com:8000/
ProxyPassReverse / http://example.com: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/

Cheers-

-Ezra Z.
Yakima Herald-Republic
WebMaster

509-577-7732
[email protected]

Thank you Ezra,

Metta
john

I found all I needed in Apache 2 was ProxyPass:

Proxy to webrick

ProxyPass / http://127.0.0.1:3001/

– Wes

On 3/23/06, John N. Alegre [email protected] wrote:

thread, please direct me there. An initial search of the
I want to run standard Apache serving the site. I want to serve

rewrite modules to send requests on port 80 to a local or remote

-- Wes