<?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: Nginx and Mongrel cluster on debian</title>
    <link>http://www.rubynaut.net/articles/2007/09/23/nginx-and-mongrel-cluster-on-debian</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Nginx and Mongrel cluster on debian</title>
      <description>&lt;p&gt;Nginx is a &amp;#8216;small&amp;#8217; efficient http, load balancer server. More and more popular in Rails community, it&amp;#8217;s a good front end for mongrel clusters. It&amp;#8217;s seems to be a good replacement for apache, at least for the memory usage (on my test: 1 process use 1.3M against the more than 9M taken by 1 apache process). Benchmark on one single server are quite similar.&lt;/p&gt;


	&lt;p&gt;The process has been tested on debian 4.0r1 and should work on Ubuntu.&lt;/p&gt;


	&lt;h3&gt;Installation&lt;/h3&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;apt-get install nginx&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;or, if you want an up to date product:&lt;/p&gt;


	&lt;p&gt;1/ Prepare your system&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;apt-get install zlib1g-dev libgcrypt11-dev libpcre3-dev libssl-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;2/ &lt;a href="http://sysoev.ru/nginx/download.html"&gt;Download source&lt;/a&gt;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;tar xzf nginx-0.6.12.tar.gz
cd nginx-0.6.12&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;3/ Compile it&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;./configure --pid-path=/usr/local/nginx/logs/nginx.pid \
    --sbin-path=/usr/local/sbin/nginx \
    --with-md5=/usr/lib \
    --with-sha1=/usr/lib \
    --with-http_ssl_module \
    --with-http_dav_module --prefix=/usr \
    --conf-path=/etc/nginx/nginx.conf \
    --pid-path=/var/run/nginx.pid \
    --lock-path=/var/run/nginx.lock \
    --error-log-path=/var/log/nginx/error.log \
    --http-log-path=/var/log/nginx/access.log 

make

sudo make install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;Configuration&lt;/h3&gt;


	&lt;p&gt;The following configuration is for 1 nginx server with load balancing 3 mongrel in cluster:&lt;/p&gt;


	&lt;p&gt;1/ Mongrel cluster configuration&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;gem install mongrel_cluster -y

cd /var/www/my-app-path/current/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;configures 3 mongrel in cluster, in production mode, starting at port 5000 and listening on localhost&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo mongrel_rails cluster::configure -e production \
    -p 5000 -N 3 -c /var/www/my-app-path/current/ -a 127.0.0.1 \
    --user www-data

mongrel_rails cluster::start&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;2/ Nginx&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;nano /etc/nginx.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Use the &lt;a href="http://brainspl.at/nginx.conf.txt"&gt;nginx.conf&lt;/a&gt; file from &lt;a href="http://brainspl.at/"&gt;brainspl.at&lt;/a&gt; website, change the 2 or 4 (if you use ssl) references to the path of your application (/var/www/my-app-path/current/)&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;/etc/init.d/nginx start&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;All these information come from many website (thanks to all), I put them together for my own usage, hope it&amp;#8217;s helpfull.&lt;/p&gt;</description>
      <pubDate>Sun, 23 Sep 2007 18:24:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:9166bf4a-f5fb-47bc-a811-5f0b1cde8ff0</guid>
      <author>stephane</author>
      <link>http://www.rubynaut.net/articles/2007/09/23/nginx-and-mongrel-cluster-on-debian</link>
    </item>
    <item>
      <title>"Nginx and Mongrel cluster on debian" by mind</title>
      <description>&lt;p&gt;I really like more the apache proxy balancer, and mongrel cluster deploy.&lt;/p&gt;</description>
      <pubDate>Wed, 27 Feb 2008 19:33:40 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:fe55b25a-73d6-48d0-938a-0eaea9474055</guid>
      <link>http://www.rubynaut.net/articles/2007/09/23/nginx-and-mongrel-cluster-on-debian#comment-2020</link>
    </item>
    <item>
      <title>"Nginx and Mongrel cluster on debian" by Jeremy</title>
      <description>&lt;p&gt;You can now do:&lt;/p&gt;


	&lt;p&gt;apt-get install mongrel-cluster&lt;/p&gt;</description>
      <pubDate>Tue, 12 Feb 2008 07:55:16 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:0c2bb531-e4af-4e42-834f-625a7b6b14a4</guid>
      <link>http://www.rubynaut.net/articles/2007/09/23/nginx-and-mongrel-cluster-on-debian#comment-2015</link>
    </item>
    <item>
      <title>"Nginx and Mongrel cluster on debian" by Stephane</title>
      <description>&lt;p&gt;hehe thanks for the comments.&lt;/p&gt;</description>
      <pubDate>Fri, 18 Jan 2008 22:44:31 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:7a56be9a-ff7c-45bf-83c2-c5897ec6aef4</guid>
      <link>http://www.rubynaut.net/articles/2007/09/23/nginx-and-mongrel-cluster-on-debian#comment-2013</link>
    </item>
    <item>
      <title>"Nginx and Mongrel cluster on debian" by nginx</title>
      <description>&lt;p&gt;I think you&amp;#8217;re forgetting the &amp;#8216;make ; sudo make install&amp;#8217; part???&lt;/p&gt;</description>
      <pubDate>Wed, 16 Jan 2008 07:09:25 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:14c0ed4f-cc83-4458-8de8-a985796bafc4</guid>
      <link>http://www.rubynaut.net/articles/2007/09/23/nginx-and-mongrel-cluster-on-debian#comment-2012</link>
    </item>
    <item>
      <title>"Nginx and Mongrel cluster on debian" by Wolfgang</title>
      <description>Hmm, I don&amp;#8217;t know what &amp;#8220;start&amp;#8221; does&amp;#8230;
&lt;pre&gt;mongrel_rails cluster::start&lt;/pre&gt;
works for me</description>
      <pubDate>Thu, 06 Dec 2007 15:38:47 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:3c315c43-7037-468a-932d-1ca473a148fa</guid>
      <link>http://www.rubynaut.net/articles/2007/09/23/nginx-and-mongrel-cluster-on-debian#comment-1999</link>
    </item>
  </channel>
</rss>
