<?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>iandouglas.com &#187; nginx</title>
	<atom:link href="http://iandouglas.com/tag/nginx/feed/" rel="self" type="application/rss+xml" />
	<link>http://iandouglas.com</link>
	<description>senior web architect</description>
	<lastBuildDate>Wed, 07 Dec 2011 21:16:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Nginx and Postgres FTS</title>
		<link>http://iandouglas.com/2011/01/05/nginx-and-postgres-fts/</link>
		<comments>http://iandouglas.com/2011/01/05/nginx-and-postgres-fts/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 17:39:39 +0000</pubDate>
		<dc:creator>ian douglas</dc:creator>
				<category><![CDATA[webdev]]></category>
		<category><![CDATA[aggregated]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[fts]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://twitter.com/iandouglas736/statuses/22708821143064576</guid>
		<description><![CDATA[iandouglas736: after seeing the neat full text search capabilities of Postgres last night, I'm going to try to build it into an nginx module.]]></description>
			<content:encoded><![CDATA[<p>I tinkered with PostgreSQL's full-text-search (FTS) capabilities and I'm pretty impressed. On a table with 1.2 million rows of user profile information, I can do a token-based FTS search for usernames in under 90 milliseconds. Unfortunately, the FTS token system doesn't recognize MixedCaseUsernames, or numbers between words, as word separators. I did, however, fall quickly in love with the marker tag system which tells Postgres to prepend and append HTML 4 bold tags around matching portions of text.
<p>After a little help from the #postgres IRC channel on freenode, I also had an all-SQL approach to finding username portions based on 3-character tokens generated from the entire username. Yes, this index took a while to build, but that's not the point.
<p>The point is that now I have a stored procedure that does a 2-part lookup, one using PostgreSQL's token search, the other doing an ILIKE comparison based on the 3-character token bits, finds a unique list of matches via DISTINCT, limits the count, and then loops through the result set adding my own bold tags to the results, and returns the entire set in under 100ms.
<p>I was able to get Nginx up and running with the ngx_postgres module, and it works well for our application, but some caching around the results would be nice. I'm waiting to hear back from the author of ngx_postgres and the author of the srcache-nginx-module project to see if they have additional insights as to why using srcache is trying to force an SSL connection to Postgres. Once we can add that caching layer, this setup should scream.]]></content:encoded>
			<wfw:commentRss>http://iandouglas.com/2011/01/05/nginx-and-postgres-fts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO: redirect iPhone/iPod users on nginx</title>
		<link>http://iandouglas.com/2010/01/20/howto-redirect-iphoneipod-users-on-nginx/</link>
		<comments>http://iandouglas.com/2010/01/20/howto-redirect-iphoneipod-users-on-nginx/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 23:44:46 +0000</pubDate>
		<dc:creator>ian douglas</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://iandouglas.com/?p=35</guid>
		<description><![CDATA[I learned a little something about nginx, a small footprint web server that is ideal for serving up mobile sites, or sites where you don&#8217;t want the heavy usage of Apache. Today, I needed to solve a problem where we redirected iPhone/iPod users to a different URL. Since nginx doesn&#8217;t use the old-style mod_rewrite rules, [...]]]></description>
			<content:encoded><![CDATA[<p>I learned a little something about nginx, a small footprint web server that is ideal for serving up mobile sites, or sites where you don&#8217;t want the heavy usage of Apache. Today, I needed to solve a problem where we redirected iPhone/iPod users to a different URL. Since nginx doesn&#8217;t use the old-style mod_rewrite rules, I had to learn how to enable redirection in the server.</p>
<p>Since nginx was already compiled with redirection support, I simply had to locate the correct configuration file and add a few lines of code, and away it went.</p>
<p>First, I checked out /etc/nginx/ and opened the site configuration file within the /sites-enabled/ path. For this example, let&#8217;s say the site was m.iandouglas.com:</p>
<pre><code># vi /etc/conf/nginx/sites-enabled/m.iandouglas.com</code></pre>
<p>In here, I&#8217;d look for the &#8216;server&#8217; block and add my redirection rules:</p>
<pre><code>server {
	listen      80;
	server_name m.iandouglas.com;
        root /var/www/m.iandouglas.com/public;

	# redirect iPhone/iPod users to the new iphone site
        if ($http_user_agent ~* '(iPhone|iPod)') {
                rewrite ^/$ http://m.iandouglas.com/iphone/index.html;
        }
.
.
.
</code></pre>
<p>Then a simple nginx restart:</p>
<p><code># /etc/init.d/nginx restart</code></p>
<p>&#8230; and we were all set.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandouglas.com/2010/01/20/howto-redirect-iphoneipod-users-on-nginx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

