<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Rubynaut: Apache, Mongrel (cluster) and Rails are on a load balancer</title>
    <link>http://www.rubynaut.net/articles/2007/09/22/apache-mongrel-cluster-rails-are-on-a-load-balancer</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Apache, Mongrel (cluster) and Rails are on a load balancer</title>
      <description>&lt;p&gt;Following the conference, and some information about scaling Rails application, I decided to investigate about it and write a post on it.&lt;/p&gt;


	&lt;p&gt;First, I tried to install FreeBSD as recommended for small configuration&amp;#8230; Well, I still don&amp;#8217;t get it, I&amp;#8217;m not fan of this installation and stop trying to understand, instead I installed a Debian 4.0R1, not so bad and closer to what I know :)&lt;/p&gt;


	&lt;p&gt;Secondly, I want to try Nginx. First, need to find the good one to install on Debian, not last dev, maybe the one on the testing repository. Finally I found package with the 0.5.31, latest stable version. Easy to install with dpkg, I only wanted to simply configure static server and point on php application I have. Ouch, the php-cgi stuff is pretty much more complicated than expected, I &lt;del&gt;had a look to a Rails configuration and&lt;/del&gt; gave up :p.(update: configuration of one server is not so complicated, at least for rails, not more than load_balancer in apache, but it is for php and if you want to dispatch &lt;span class="caps"&gt;URL&lt;/span&gt; on the same domain, it doenst seem trivial)&lt;/p&gt;


	&lt;p&gt;Then I went back to something I can handle: apache. I have read some article about 2.2 you can use with load_balancer and several mongrel instances. Let&amp;#8217;s go for it. I found a very complete article: &lt;a href="http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/"&gt;Time For A Grown-Up Server: Rails, Mongrel, Apache, Capistrano and You&lt;/a&gt; used also by mongrel website about &lt;a href="http://mongrel.rubyforge.org/docs/apache.html"&gt;Apache Best Practice Deployment&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;As I faced some issues, please be careful about the following:&lt;/p&gt;


	&lt;p&gt;1/ Mods to activate:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;a2enmod proxy
a2enmod proxy_http
a2enmod rewrite
a2enmod deflate
a2enmod headers
a2enmod cache
a2enmod mem_cache
a2enmod file_cache &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;2/ Forbidden access ?
If you have some issue with forbidden access please check your proxy conf file and replace&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;Order deny,allow
Deny from all&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;by&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;Order allow,deny
Allow from all&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Enjoy!&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ll try again &lt;a href="http://nginx.net/"&gt;Nginx&lt;/a&gt; and maybe also pen / pound and &lt;a href="http://litespeedtech.com/"&gt;litespeed&lt;/a&gt;. A buzzy load balancer: &lt;a href="http://haproxy.1wt.eu/"&gt;HAProxy&lt;/a&gt;. A lot of work is coming :p. If you have some feedback about these configuration don&amp;#8217;t hesitate to share it :)&lt;/p&gt;</description>
      <pubDate>Sat, 22 Sep 2007 21:04:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:12cfaadf-f004-42c7-9a92-434dbba6ccd0</guid>
      <author>stephane</author>
      <link>http://www.rubynaut.net/articles/2007/09/22/apache-mongrel-cluster-rails-are-on-a-load-balancer</link>
    </item>
  </channel>
</rss>
