Forum: Ruby on Rails Apache - Rails communication.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
17e82d98739e0be1ec136265ec940c34?d=identicon&s=25 John N. Alegre (Guest)
on 2006-03-22 16:10
(Received via mailing list)
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
132a94ca65959bda6c74fae54bff2425?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-03-22 21:10
(Received via mailing list)
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
> Rails@lists.rubyonrails.org
> 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/
</VirtualHost>

Apache 2.x:
<VirtualHost *:80>
     ServerAdmin                 webmaster@username.tld
         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/
</VirtualHost>


Cheers-

-Ezra Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
17e82d98739e0be1ec136265ec940c34?d=identicon&s=25 John N. Alegre (Guest)
on 2006-03-23 16:28
(Received via mailing list)
Thank you Ezra,

Metta
john
A332dcb1e051f733dc9a9bd78df3b560?d=identicon&s=25 Wes Garrison (Guest)
on 2006-03-23 16:38
(Received via mailing list)
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 <lists@johnalegre.net> 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
> > </VirtualHost>
> > </VirtualHost>
> >
>
--

    -- Wes
This topic is locked and can not be replied to.