<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>rel=me &#187; nginx</title>
	<atom:link href="http://rel.me/t/nginx/feed/" rel="self" type="application/rss+xml" />
	<link>http://rel.me</link>
	<description>programming, objective-c, cocoa, iphone, c</description>
	<lastBuildDate>Mon, 02 Aug 2010 20:09:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>nginx conf with alternate cache dir</title>
		<link>http://rel.me/2008/01/07/nginx-conf-with-alternate-cache-dir/</link>
		<comments>http://rel.me/2008/01/07/nginx-conf-with-alternate-cache-dir/#comments</comments>
		<pubDate>Mon, 07 Jan 2008 07:25:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">/2008/01/07/nginx-conf-with-alternate-cache-dir</guid>
		<description><![CDATA[Its a good idea to use an alternate cache directory in rails (in your environment.rb): config.action_controller.page_cache_directory = RAILS_ROOT + &#34;/public/cache/&#34; This makes it easier to sweep. To setup nginx to pick up from a rails alternate cache directory like public/cache, I used: if ($http_user_agent ~* &#34;(iPhone&#124;iPod)&#34;) { rewrite ^/$ /iphone break; proxy_pass http://mongrel-pt; break; } [...]]]></description>
			<content:encoded><![CDATA[<p>Its a good idea to use an alternate cache directory in rails (in your environment.rb):</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">config.<span class="me1">action_controller</span>.<span class="me1">page_cache_directory</span> = RAILS_ROOT <span class="sy0">+</span> <span class="st0">&quot;/public/cache/&quot;</span></pre></div></div>

<p>This makes it easier to sweep. To setup nginx to pick up from a rails alternate cache directory like public/cache, I used:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">if ($http_user_agent ~* &quot;(iPhone|iPod)&quot;) {
  rewrite ^/$ /iphone break;
  proxy_pass http://mongrel-pt;
  break;
}
&nbsp;
if (-f $request_filename) {
  break;
}
&nbsp;
if (-f $document_root/cache/$uri/index.html) {
  rewrite (.*) /cache/$1/index.html break;
}
&nbsp;
if (-f $document_root/cache/$uri.html) {
  rewrite (.*) /cache/$1.html break;
}
&nbsp;
if (-f $document_root/cache/$uri) {
  rewrite (.*) /cache/$1 break;
}
&nbsp;
if (!-f $request_filename) {
  proxy_pass http://mongrel-pt;
  break;
}</pre></div></div>

<p>It was a little tricky to figure out to use the $uri variable. The first rewrite is used for iphone requests so it doesn&#8217;t get the non-iphone cached page.</p>
]]></content:encoded>
			<wfw:commentRss>http://rel.me/2008/01/07/nginx-conf-with-alternate-cache-dir/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>nginx</title>
		<link>http://rel.me/2007/09/03/nginx/</link>
		<comments>http://rel.me/2007/09/03/nginx/#comments</comments>
		<pubDate>Mon, 03 Sep 2007 04:56:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[mongrel_cluster]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">/2007/09/03/nginx</guid>
		<description><![CDATA[I switched from apache + mod_proxy_balancer to nginx, which on my lame VPS is saving me around 14 precious MB of memory. There are so many reasons to use nginx. Ezra recommends the monit + nginx + mongrel_cluster stack, and my friend/co-worker has a great conf to start with. It took me about 5 minutes [...]]]></description>
			<content:encoded><![CDATA[<p>I switched from apache + mod_proxy_balancer to nginx, which on my lame VPS is saving me around 14 precious MB of memory. There are so many reasons to use nginx. <a href="http://engineyard.com/">Ezra</a> recommends the monit + nginx + mongrel_cluster stack, and my friend/co-worker <a href="http://www.fucema.net/2007/8/28/rails-on-mongrel-cluster-nginx">has a great conf</a> to start with. It took me about 5 minutes to setup, even with multiple hosts.</p>
<p>My <a href="/nginx_conf.txt">nginx.conf</a> and <a href="/nginx_init.txt">init script</a>.</p>
<p>Nginx is hyper optimized&#8230;</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">./ngx_http_upstream.c:        if (h-&gt;value.len == 2) {<tt>
</tt>./ngx_http_upstream.c:            if (c0 == 'n' &amp;&amp; c1 == 'o') {<tt>
</tt>./ngx_http_upstream.c:        } else if (h-&gt;value.len == 3) {<tt>
</tt>./ngx_http_upstream.c:            if (c0 == 'y' &amp;&amp; c1 == 'e' &amp;&amp; c2 == 's') {</pre>
</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://rel.me/2007/09/03/nginx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
