Successful Settings for Apache forwarding to Mongrel
So, after a day of working on it, I finally fixed the problems I was having.
I wanted to have Apache forward all traffic hitting a path to a mongrel server running in a rails application. So, I did as bish0p suggested, and set up the rails app to accept this behavior. First, I put this at the bottom of my environment.rb:
ActionController::AbstractRequest.relative_url_root = "/MyRailsApp"
This make it so all the urls in the Rails app are prepended with /MyRailsApp. Without this, you’ll get renders that don’t have stylsheets, javascripts, or anything else that resides in the public directory of rails.
Second, I made a ProxyPass entry in the Apache configuration:
Redirect /MyRailsApp http://www.example.com/MyRailsApp/
ProxyPass /MyRailsApp/ http://localhost:6402/MyRailsApp/
ProxyPassReverse /MyRailsApp/ http://localhost:6402/MyRailsApp/
This allows all traffic that goes to /MyRailsApp on the server to be redirected to my mongrel server, which is running on port 6402 (This port does not have to be unfirewalled since all the requests are done locally by Apache).
Next, I have to further fix the problem of mongrel not being able to find things in public by making a symlink in public to itself. Make sure not to just do a link to ../public. Here’s an example:
cd public
mkdir MyRailsApp # This has to be whatever you used in your Apache configuration.
cd MyRailsApp
ln -s ../* . # Link to everything above.
rm MyRailsApp # Get rid of the recursive link.
Now, just configure your db, application, etc. and start the mongrel server from the root of the application.
mongrel_rails start -p 6402 -e production -d
And voila! You have a working ProxyPass connection from Apache to Mongrel.
Update:
Thanks to this article, I now have mod_deflate running! It was very easy to install:
apxs -c -i mod_deflate.c # As Root
This will install it to your apache installation’s modules directory. Now, just add some lines in your config:
Redirect /MyRailsApp http://www.example.com/MyRailsApp/
ProxyPass /MyRailsApp/ http://localhost:6402/MyRailsApp/
<Location /MyRailsApp>
ProxyPassReverse /MyRailsApp
SetOutputFilter INFLATE;proxy-html;DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
</Location>
Congratulations, you’re now deflating your HTML/XML/CSS/JS/PlainText files! This works on all modern browsers (yes, even Lynx), and greatly reduces the size of the files sent. Here’s a summary:
Before:
14.4K: 172.65 seconds
28.8K: 86.32 seconds
33.6K: 73.99 seconds
56K: 44.40 seconds
ISDN 128K: 13.60 seconds
T1 1.44Mbps: 1.18 seconds
After:
14.4K: 52.27 seconds
28.8K: 26.13 seconds
33.6K: 22.40 seconds
56K: 13.44 seconds
ISDN 128K: 4.12 seconds
T1 1.44Mbps: 0.36 seconds
Roughly 3 times as fast!!
Also, it may be possible to leave off a lot of the junk here. I might have to streamline the configuration some in the following days. If I’m right, you won’t even need the ActionController line anymore.

I`m interested there`s a lot of articles on casino gambling. There are different methods, tactics, strategies, algorithms of counting, calculations and so on.
But these items are only heap of ads and i don`t want to analyze them `cause i don`t have any basic knowledge. It`s ineffective. Estimation i think will be wrong.
Is there anyone here who is attracted in such topic?
I`d appreciate someone`s explaining to me is there any systems or strategies, what are they (what approaches or concepts lay in basis) and in which casinos could they be applied to?
Thanx a lot.
This piece was everything I needed; it filled in the blanks of all the other articles. For some reason, no other articles consider the fact that someone might have an existing setup that needs to remain, or that they would like to run multiple rails apps on one host. This was the solution I needed, thanks again.
I think it’s time to give mongrell a try :) As Mike said all blanks are filled now .
Hi,
I got it nearly working using your suggestions. I now have a working page with a working theme – but I cannot access the admin page at all. It just loads the normal frontpage. Any ideas?
hi .
I want to use the openser aadministrator tool for Voip in openSER,
but… I follow the steps in openser administrator doc…
The webrick started .. its shows the application error ( rails) .
But this is very very fair to me.. kool to use for admin in Voip technology…