[Mongrel] mongrel served from a subdirectory

Michael Fairchild rmdf at stimble.net
Fri Dec 1 04:15:38 EST 2006


Yeah!  Success feels so good:-)  Thanks for the tips.
To summarize, in case any body else comes along with a similar need to serve
a rails app from sub directory.  For example i wanted to serve my rails app
from example.edu/docserver instead of docserver.example.edu.

first: you must have the  in your hosts apache configuration
     ProxyPass /docserver/ http://example.edu:3001/docserver/
     ProxyPassReverse /docserver/ http://example.edu:3001/docserver/
     ProxyPreserveHost on

 > mongrel_rails start --prefix=/docserver


Having the trailing /docserver at the end of the ProxyPass and the
--prefix=/docserver are the main difference from a regular
docserver.example.edu type setup.

I did not need RAILS_RELATIVE_URL_ROOT="/docserver/" in enviornment.rb.

caveats:
  Any relative links that are hardcoded will break, so link_to helpers need
to be used exclusivley for these links.
  Same goes for form action urls.

would it be worth puting something about the ProxyPass changes in the faq
under
"How do I put my Rails site at /someprefix?" Thanks for the help,
~michael fairchild



On 11/30/06, Michael Fairchild < rmdf at stimble.net> wrote:
>
> Thanks for that Philip.  I missed that option.  I tried starting up with
> that, but --prefix=/docserver and leaving the apache stuff the same.  When i
> did that i couldn't even get any of it.
> I think there might be something i need to set in enviornment.rb, but  im
> not sure.
> I'll keep trying.
> ~michael
>
> On 11/30/06, Philip Hallstrom <mongrel at philip.pjkh.com > wrote:
> >
> > > Hello,
> > > I have setup mongrel successfully a few times now, but, each time I
> > have
> > > used apaceh 2.2 and mod_proxy setup descibed on the mongrel site.
> > > However, I need to set up another app in a subdomain.  example.com/docserver
> > > instead of docserver.example.com.
> > > I have tried just adding  I have something like:
> > >
> > >    ProxyPass /docserver/ http://example.com:3001/
> > >    ProxyPassReverse /docserver/ http://example.com:3001
> > >    ProxyPreserveHost on
> > >
> > > The problem seems to be two fold.  First, the css, image and
> > javascript
> > > links, are all broken.  Second all the generated links are to
> > > /controller/action instead of to docserver/controller/action.
> > >
> > > I tried putting RAILS_RELATIVE_URL_ROOT="/docserver/" in
> > enviornment.rb, but
> > > that didn't help.
> >
> > I haven't done it, but seems my memory is there is a --prefix option to
> > mongrel that you need to set as well...
> >
> > Check the mongrel site to see if there any docs on this...
> > _______________________________________________
> > Mongrel-users mailing list
> > Mongrel-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/mongrel-users
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20061201/db70a86b/attachment.html 


More information about the Mongrel-users mailing list